NSNumberFormatter for 2 Decimal Places

131 Views Asked by At

I have some amount that i want to Display in local Style.

NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc]init];
numberFormatter.locale = [NSLocale currentLocale];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
numberFormatter.usesGroupingSeparator = YES;

NSString* amountText = [NSString stringWithFormat:@"ab %@€",[numberFormatter stringFromNumber:someDoubleNumber]];

Problem is that this is also displaying the currency and that is something that i don't want. Basically what i am looking for is displaying that decimal should be according to local Style with 2 numbers after decimal for example 0.00 or in germany 0,00 with my code i am achieveing this requirement but i am also getting the additionally the currency symbol which i don't want.

1

There are 1 best solutions below

0
dev_ios999 On

Anybody still looking for an answer i achieved it by

[numberFormatter setCurrencySymbol:@""];