Mac Convert comma separated list into array?

Locker

macrumors 6502
Original poster
Aug 22, 2007
291
0
Staffordshire, UK
I have a webpage which will generate a comma separated list of numbers. I want to get these numbers into an NSMutableArray. How would I go about doing so?
 

Aquis

macrumors member
Aug 7, 2007
63
0
Staffordshire, UK
Assuming you've read the list into a string:
Code:
NSArray * list = [theString componentsSeperatedByString:@","];
To make a mutable version of that array:
Code:
NSMutableArray * mutableList = [NSMutableArray arrayWithArray:list];
Edit: That will make a list of strings though; if you want NSNumbers to be in the array, you'll probably have to loop through and change them.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.