0

I am using NSNumberFormatter to create a currency formatted string. Everything works fine on most devices, but on some devices for example devices with Korean language, the $ sign shows up as a rectangle.

NSNumberFormatter *currencyStyle = [[NSNumberFormatter alloc] init];
[currencyStyle setFormatterBehavior:NSNumberFormatterBehavior10_4];
[currencyStyle setNumberStyle:NSNumberFormatterCurrencyStyle];
NSNumber *amount = [NSNumber numberWithInteger:moneyAmount];
NSString *amountString =  [NSString stringWithFormat:@"%@", [currencyStyle stringFromNumber:amount]];
[currencyStyle release];

Any way to fix this problem?

Rhanks

4

1 回答 1

2

Given your comment in the question, it sounds like you just want the $ currency symbol, regardless of whatever the defined currency symbol is for the user's current locale.

This is done using the -setCurrencySymbol: instance method of the NSNumberFormatter class. In your case, you could do the following:

[currencyStyle setCurrencySymbol:@"$"]; 
于 2010-10-10T01:53:50.233 回答