I am using code below to generate a number for spanish as €1.000.000,00 but I am getting €1,000,000.00. I am using es_ES as locale ID.
NSNumberFormatter *frm=[[NSNumberFormatter alloc] init];
[frm setNumberStyle:NSNumberFormatterDecimalStyle];
NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"];
[frm setLocale: locale];
NSString *symbol = [locale objectForKey:NSLocaleCurrencySymbol];
[frm setCurrencySymbol:[locale objectForKey:NSLocaleCurrencySymbol]];
NSString *formattedAmt= [frm stringFromNumber:[NSNumber numberWithDouble:[amount doubleValue]]];
Does anyone know why I am not getting proper format?
Thanks in advance!
You have to set
NSNumberFormatterCurrencyStyle
instead ofNSNumberFormatterDecimalStyle
andCurrencySymbol
to Empty to remove the symbol of Currency.Working Code :
Output (As you want without Currency Symbol) :