如何将带逗号分隔项的字符串转换为数组

Ash*_*iya -1 arrays iphone objective-c ios

可能重复:
如何将字符串转换为带分隔符的数组?

假设:

string = @"Abc, Def, Ghi, Lmno";
Run Code Online (Sandbox Code Playgroud)

我希望那些用逗号分隔的单词在这样的数组中:

元素0 = Abc,

元素1 = Def,

元素2 = Ghi,

元素3 = Lmno.

Nim*_*ekh 9

NSArray *myArray = [myString componentsSeparatedByString:@","];

[myArray objectAtIndex:0];//Abc
[myArray objectAtIndex:1];//Def
[myArray objectAtIndex:2];//Ghi
[myArray objectAtIndex:3];//Lmno
Run Code Online (Sandbox Code Playgroud)