2011-05-19 99 views
0

我得到串這是 字符串* NEWID = @「12390,12391,12392,12394,12394,12395,12396」添加數據串陣列

這是請求發送給我。

我需要從字符串中添加每個id到NSMutableArray或NSMutableDictionary中。

回答

3
NSString *[email protected]"12390,12391,12392,12394,12394,12395,12396"; 
NSMutableArray *arrayIds = [[newID componentsSeparatedByString:@","] mutableCopy]; 
+0

其工作NSArray ..... – 2011-05-19 10:46:13

+0

我們可以做到這一點 NSMutableArray或NSMutableDictionary – 2011-05-19 10:53:44

+0

更新我的答案nsmutablearray – Eimantas 2011-05-19 11:14:19

1

array = [newID componentsSeparatedByString:@「,」];

0

嘗試

NSString *[email protected]"12390,12391,12392,12394,12394,12395,12396"; 
NSArray *arrays = [newID componentsSeparatedByString:@","]; 
NSMutableArray *arr = [NSMutableArray arrayWithArray:arrays]; 
0
NSString *[email protected]"12390,12391,12392,12394,12394,12395,12396"; 
NSArray *arrayIds = [newID componentsSeparatedByString:@","]; 
NSString *str1=[arrayIds objectAtIndex:0]; 
NSString *str2=[arrayIds objectAtIndex:1]; 
. 
. 
. 
0

的NSString * NEWID = @ 「12390,12391,12392,12394,12394,12395,12396」;

array = [newID componentsSeparatedByString:@「,」];

(如果使用其他方法)[array retain];