Posts

Showing posts from March, 2012

NSString's Split and Join crash course

Split a NSString is using the NSString instance method " componentsSeparatedByString " NSString * mystring = @"coding;is;kind;of;magic" ; NSArray * mysplitedstring = [mystring componentsSeparatedByString : @";" ]; The above code will produce an array containing the following element: coding is kind of magic To join an array of NSString back to a single NSString, use the NSArray instance method " componentsJoinedByString " NSString * mystring = [mysplitedstring componentsJoinedByString : @";" ]; That will give you back the NSString "coding;is;kind;of;magic"