views:

74

answers:

1

If I want to explode a string by parts in PHP into an array, I have the nifty explode() function where I just do the following

$mystring = "HI:THERE:HOW";
$stringarray = explode(":", $mystring);

And I get

$stringarray = (
  [0] = "HI"
  [1] = "THERE"
  [2] = "HOW"
);

Is there a similar function in Objective C that explodes a string into an array? Thanks for any help!

+7  A: 
NSArray *stringArray = [myString componentsSeparatedByString:@":"];
macatomy
+1 for sheer precision.
Jonathan Grynspan