我有字符串 字符串* newID = @“12390,12391,12392,12394,12394,12395,12396”
这是发给我的请求。
我需要将string中的每个id添加到NSMutableArray或NSMutableDictionary。
答案 0 :(得分:3)
NSString *newID=@"12390,12391,12392,12394,12394,12395,12396";
NSMutableArray *arrayIds = [[newID componentsSeparatedByString:@","] mutableCopy];
答案 1 :(得分:1)
array = [newID componentsSeparatedByString:@“,”];
答案 2 :(得分:0)
尝试
NSString *newID=@"12390,12391,12392,12394,12394,12395,12396";
NSArray *arrays = [newID componentsSeparatedByString:@","];
NSMutableArray *arr = [NSMutableArray arrayWithArray:arrays];
答案 3 :(得分:0)
NSString *newID=@"12390,12391,12392,12394,12394,12395,12396";
NSArray *arrayIds = [newID componentsSeparatedByString:@","];
NSString *str1=[arrayIds objectAtIndex:0];
NSString *str2=[arrayIds objectAtIndex:1];
.
.
.
答案 4 :(得分:0)
NSString * newID = @“12390,12391,12392,12394,12394,12395,12396”;
array = [newID componentsSeparatedByString:@“,”];
(如果你使用另一种方法)[array retain];