Convert NSString in NSArray
I'm searching for a Objective-C method like PHP's explode function:
$string = "Helle#world#!";
$delimiter = "#";
$array = explode ( $delimiter, $string);
Result: $array = {"Hello", "wo开发者_如何学JAVArld", "!"}
Thanks, Andreas
You're looking for componentsSeparatedByString:
NSString *string = @"Hello#world#!";
NSString *delimiter = @"#";
NSArray *array = [string componentsSeparatedByString:delimiter];
精彩评论