示例字符串:
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"
如果这是有道理的......
任何帮助将不胜感激:)
由于
答案 0 :(得分:5)
NSArray *spliArray = [exampleString componentsSeparatedByString:@"delimiter"];