In my application ,I am handling large numbers(currencies) and I am formatting them using nsnumberformatter.however currently ,the number of decimal places are set according to the locale.Since large numbers are involved ,i dont want to display the decimal places in any currency. how to set the decimal places to zero in nsnumberformatter currency style?
code used
NSDecimalNumber *someAmount = [NSDecimalNumber decimalNumberWithString:unformattedString];
NSNumberFormatter *currencyFormatter = [[[NSNumberFormatter alloc] init] autorelease];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyFormatter setLocale:locale];
NSString *str=[NSString stringWithFormat:@"%.0f",someAmount];
//NSString *str=[currencyFormatter stringFromNumber:someAmount];
Use the code below to remove the decimal places from the number formatter:
Full code using your code above: