Chandu
Chandu

Reputation: 695

NSnumberFormatter working on simulator but not on device

There is a price field in my App. I used NSNumberFormatter and I am storing and retrieving values using core data. It's working fine on the simulator but nothing is showing up on the device.

I am also displaying the local currency value which is working fine on the simulator but not on the device. I used the following code for the currency:

NSLocale *theLocale = [NSLocale currentLocale];
NSString *a = [theLocale objectForKey:NSLocaleCurrencySymbol];

Upvotes: 1

Views: 341

Answers (1)

kaar3k
kaar3k

Reputation: 994

For Indian Number System

    NSNumberFormatter *frm=[[NSNumberFormatter alloc] init];
[frm setNumberStyle:NSNumberFormatterDecimalStyle];

    [frm setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_IN"] autorelease]];
[frm setCurrencySymbol:@""];

NSString *formattedAmt=[frm stringFromNumber:[NSNumber numberWithDouble:tmpAmt]];

Change LocaleIdentifier to en_US for Millions

Upvotes: 1

Related Questions