Split NSString using the NSString instance method
The above code will produce an array containing the following element:
To join an array of NSString back to a single NSString, use the NSArray instance method
That will give you back the NSString
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"
Comments
Post a Comment