Reputation: 4079
The web service that I am accessing returns this values:
A1;A2;A3;A4;A5;B2;B10;B11;B12;
I want to get the total count of all the data returned separated by ;
. How can I do this? I'm thinking of doing a loop inside the string, get the value before ;
but getting confused on how to properly run the loop.
Upvotes: 0
Views: 99
Reputation: 5183
There are many string functions and you can use one of them, that is componentsSeparatedByString.
Considering that above mentioned return value is a NSString.
NSString *strResponse = @"A1;A2;A3;A4;A5;B2;B10;B11;B12;"; NSArray *arCount = [strResponse componentsSeparatedByString:@";"]; NSLog(@"Total objects in response is: %d", [arCount count]);
Upvotes: 2