objective c - split NSString using componentsSeparatedByString -
i have string need split. easy using componentsseparatedbystring problem separator comma have commas aren't separator.
i explain:
my string:
nsstring *str = @"black,red, blue,yellow";
the comma between red , blue must not considered separator.
i can determine if comma separator or not checking if after there white space.
the goal obtain array with:
( black, "red, blue", yellow )
this tricky. first replace occurences of ', ' (comma+space) '|' use components separated method. once done, again replace '|' ', ' (comma+space).
Comments
Post a Comment