I'm currently trying to format a float from a JSON feed to a number using NSNumberFormatter using a currency style.
My current solution is this:
float test = 100.50; NSNumber *number = [NSNumber numberWithFloat:test]; NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; [formatter setNumberStyle:NSNumberFormatterCurrencyStyle]; [formatter setCurrencyCode:@"DKK"]; NSString *price = [formatter stringFromNumber:number];
My problem is that the output is "DKK100.50" when the correct result for the selected currency should be "DKK100.50" (note that the current result is with a dot as a decimal separator, and not as a comma).
What am I doing wrong?
source share