0

I have a NSString which looks like this @"1, 5, 23, 15, 6". What i need is to retrieve all these numbers from this string. Probably the result might look like an array of NSStrings - @"1" , @"5", @"23" and so on. How do i do that?

Andrey Chernukha
  • 21,488
  • 17
  • 97
  • 161
  • 2
    possible duplicate of [NSString tokenize in Objective-C](http://stackoverflow.com/questions/259956/nsstring-tokenize-in-objective-c) – N_A Jul 24 '12 at 16:35

1 Answers1

3
NSString *string = @"1, 5, 23, 15, 6";
NSArray *chunks = [string componentsSeparatedByString: @", "];
N_A
  • 19,799
  • 4
  • 52
  • 98