Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective C version of explode()?

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!

like image 882
Raphael Caixeta Avatar asked Sep 11 '25 04:09

Raphael Caixeta


1 Answers

NSArray *stringArray = [myString componentsSeparatedByString:@":"];
like image 188
indragie Avatar answered Sep 12 '25 19:09

indragie