Comma-separated string to NSArray in Objective-C Comma-separated string to NSArray in Objective-C arrays arrays

Comma-separated string to NSArray in Objective-C


Assuming there's no worry about escaping/unescaping commas contained within the strings, it should be this simple:

NSArray *items = [theString componentsSeparatedByString:@","];


Objective-C

NSString *list = @"Karin, Carrie, David";NSArray *listItems = [list componentsSeparatedByString:@", "];