L Locker macrumors 6502 Original poster Nov 29, 2009 #1 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?
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?
A Aquis macrumors member Nov 29, 2009 #2 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.
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.