I have an array of strings that are fractions (1/3, 2/5) etc. I need to take these strings and use them as doubles for calculations. The fractions go into the arrays as strings. Why isn’t the below code working?
NSString *localString = [array objectAtIndex:1];
double NewDouble = [localString doubleValue];
I get the first int in each string (1 instead of .333 & 2 instead of .4 from above).
I’m missing something easy and it’s driving me crazy.
Thanks
You cannot take a
NSStringrepresenting a fraction and demand its doubleValue. You have to split the string and calculate the fraction manually.