iPhone: How to get local currency symbol (i.e. "$" instead of "AU$")

This snippet returns the currency symbol ¥ for locale "ja_JP" (could be any other locale).

NSLocale* japanese_japan = [[[NSLocale alloc] initWithLocaleIdentifier:@"ja_JP"] autorelease];
 NSNumberFormatter* fmtr = [[[NSNumberFormatter alloc] init] autorelease];
 [fmtr setNumberStyle:NSNumberFormatterCurrencyStyle];
 [fmtr setLocale:japanese_japan];

 // Local currency symbol (what you're asking for)
 NSString* currencySymbol = [fmtr currencySymbol];
 NSLog( @"%@", currencySymbol ); // Prints '¥'

 // International currency symbol 
 NSString* internationalCurrencySymbol = [fmtr internationalCurrencySymbol];
 NSLog( @"%@", internationalCurrencySymbol ); // Prints 'JPY'

It's unfortunate that for au_AU you get AU$ as the local currency symbol instead of just $, but that must be the way it's meant to be displayed on iOS. However note that the international symbol printed for au_AU is not AU$ but AUD.


Your code should work, however the locale identifier is wrong. It should be "en_AU".

See "Using the Locale Object" in the "Internationalization and Localization Guide" (https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/InternationalizingLocaleData/InternationalizingLocaleData.html#//apple_ref/doc/uid/10000171i-CH13-SW4)


It's not ideal in that it's not coming out of the system, but obviously you could create your own internal table using a list of current currency symbols*. Since that list has the unicode symbols for it it would simply be a matter of matching up the Apple list of locales with the list.

Y'know, just in case the Apple-provided ones aren't actually accessible.

*Note: link not intended to be authoritative, see comments.


NSNumberFormatter *currencyFormatter = [[[NSNumberFormatter alloc] init] autorelease];
[currencyFormatter setLocale:[NSLocale currentLocale]];
[currencyFormatter setMaximumFractionDigits:2];
[currencyFormatter setMinimumFractionDigits:2];
[currencyFormatter setAlwaysShowsDecimalSeparator:YES];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];

NSNumber *someAmount = [NSNumber numberWithFloat:5.00];    
NSString *string = [currencyFormatter stringFromNumber:someAmount];

You will receive $5.00 for US, ¥5.00 for Japan, 5.00€ for Europe, etc.