views:

44

answers:

1

Hi,

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

+3  A: 

You're looking for componentsSeparatedByString:

NSString *string = @"Hello#world#!";
NSString *delimiter = @"#";
NSArray *array = [string componentsSeparatedByString:delimiter];
dreamlax
Thanks. Thats what I was looking for. :-)
Andreas Prang