1

示例字符串:

NSString * exampleString = 
@""
 "#--- delimiter2 ---"
 "bla,"
 "bla,"
 "bla"
 "#--- delimiter2 ---"
 "yoip,"
 "yoip,"
 "yoip"
 "#--- delimiter3 ---"
 "etc,"
 "etc,"
 "etc,"
 "etc,"
 "etc,"
 "etc,"
 "etc";

我想获取一个数组并将其填充为:

[anyArray objectAtIndex:0] = @"bla,bla,bla"

[anyArray objectAtIndex:1] = @"yoip,yoip,yoip"

[anyArray objectAtIndex:2] = @"etc,etc,etc,etc,etc,etc,etc"

如果这有意义...

任何帮助,将不胜感激 :)

谢谢

4

1 回答 1

5
NSArray *spliArray = [exampleString componentsSeparatedByString:@"delimiter"];
于 2012-04-20T11:29:48.803 回答