基于这样的消除器从String中提取单词

时间:2011-05-22 11:11:15

标签: objective-c ios

我有这个字符串:

Charle,Mike,Stephan,Andre,Jenny,

我只想得到:

Charle
Mike
Stephan
Andre
Jenny

所以只是提取基于,字符的单词,哪个函数可以在cocoa中执行此操作?

1 个答案:

答案 0 :(得分:4)

NSString *string = @"Charle,Mike,Stephan,Andre,Jenny,";
NSArray *names = [string componentsSeparatedByString: @","];