如何在iphone中分隔NSMutableArray中的值

时间:2011-08-02 12:37:09

标签: iphone objective-c nsmutablearray

My NsmutableArray的值类似于

myArray = "1,2,3,4,5....10";

这些来自服务器。我想将它分开,如

myarray = 1
          2
          3
          .
          .
          .
          10

我该怎么办?

2 个答案:

答案 0 :(得分:1)

我猜this link会帮助你。

服务器的响应是NSString。用分隔符拆分它。

答案 1 :(得分:0)

您的回复将在NSString

// it will remove the double qoutes from your response
NSString *temp = [responseString stringByReplacingOccurrencesOfString:@"\"" withString:@""]; 

// gives a array of 1 2 3 ...
NSArray *aArray = [temp componentsSeparatedByString:@","];
希望它可以帮助你...