NSString tokenize in Objective-C

ggarber picture ggarber · Nov 3, 2008 · Viewed 71.3k times · Source

What is the best way to tokenize/split a NSString in Objective-C?

Answer

Adam Alexander picture Adam Alexander · Nov 3, 2008

Found this at http://borkware.com/quickies/one?topic=NSString (useful link):

NSString *string = @"oop:ack:bork:greeble:ponies";
NSArray *chunks = [string componentsSeparatedByString: @":"];

Hope this helps!

Adam