I have a JSON feed connected to my app. One of the items is lat & long separated by a comma. For example: "32.0235, 1.345".
I'm trying to split this up into two separate values by splitting at the comma.
Any advice? Thanks!!
I have a JSON feed connected to my app. One of the items is lat & long separated by a comma. For example: "32.0235, 1.345".
I'm trying to split this up into two separate values by splitting at the comma.
Any advice? Thanks!!
Try
[yourCommaSeparatedString componentsSeparatedByString:@", "]
that will give a NSArray with strings you can then call floatValue on ;)
You want:
- (NSArray *)componentsSeparatedByString:(NSString *)separator
using @"," as separator.
See in documentation
This is work for me as I was not looking to define any Array.