I have a string :
NSString *s = @"a+v+c+d";
Where '+' is the delimiter.
I want to store each a,b,c,d in array. How can it be done in objective C?
I have a string :
NSString *s = @"a+v+c+d";
Where '+' is the delimiter.
I want to store each a,b,c,d in array. How can it be done in objective C?
- (NSArray *)componentsSeparatedByString:(NSString *)separator
is the method you are looking for
NSArray *yourArray = [yourString componentsSeparatedByString:@"+"];
-[NSString componentsSeparatedByString:] returns a, v, c, d as elements in an NSArray.
Use -[NSString componentsSeparatedByCharactersInSet:] if you have more than one delimiter.