Reputation: 2217
I'm searching for a Objective-C method like PHP's explode function:
$string = "Helle#world#!";
$delimiter = "#";
$array = explode ( $delimiter, $string);
Result: $array = {"Hello", "world", "!"}
Thanks, Andreas
Upvotes: 1
Views: 2261
Reputation: 95355
You're looking for componentsSeparatedByString:
NSString *string = @"Hello#world#!";
NSString *delimiter = @"#";
NSArray *array = [string componentsSeparatedByString:delimiter];
Upvotes: 6