I used this code to cut the string
NSString *titleString = @"22.225453615805794,113.554006577014889";
NSArray *array = [titleString componentsSeparatedByString:@","];
NSLog(@"title string %@", titleString);
NSLog(@"first %.15f", [[array objectAtIndex:0] floatValue]);
NSLog(@"second %.15f", [[array objectAtIndex:1] floatValue]);
but why it return
22.225454330444336
and
113.554008483886719
Because floating point numbers are not that accurate, you can get a higher accuracy by calling
doubleValueinstead offloatValue:This is not a problem with
componentsSeparatedByString:.