Is there any way to split strings in objective c into arrays? I mean like this - input string Yes:0:42:value into an array of (Yes,0,42,value)?
NSArray *arrayOfComponents = [yourString componentsSeparatedByString:@":"];
where yourString contains @"one:two:three"
@"one:two:three"
and arrayOfComponents will contain @[@"one", @"two", @"three"]
@[@"one", @"two", @"three"]
and you can access each with NSString *comp1 = arrayOfComponents[0];
NSString *comp1 = arrayOfComponents[0];
(https://developer.apple.com/documentation/foundation/nsstring/1413214-componentsseparatedbystring)
1.4m articles
1.4m replys
5 comments
57.0k users