开发者

String Manipulation in iPhone

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
    )
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜