I am having a lengthy string which contains alphabets and a special character like "|". i need to split this strings based on the "|" delimiter and store the individual string in to 开发者_如何学编程an array. Is there any string function which helps us to do the same.?
Thanks, Shibin.
Sounds like you need componentsSeparatedByString:
NSString *string = @"hello|how|are|you";
NSArray *array = [string componentsSeparatedByString:@"|"];
NSLog(@"array: %@", array);
Output:
array: (
hello,
how,
are,
you
)
精彩评论