How can i get currency symbols from currency code in iphone?

Yuvaraj.M picture Yuvaraj.M · Jan 3, 2012 · Viewed 15k times · Source

I have get currency code (Eg: USD, EUR, INR) from webservice response. I need to show the currency symbols for the corresponding currency code. If the currency code is USD, i need to show $, if the currency code is EUR i need to show €. How can i do this? Please suggest any idea or sample code to do this. Please help me. Thanks in advance.

Answer

Yuvaraj.M picture Yuvaraj.M · Jan 3, 2012

This code works charm in my project. I will share this to you all.

NSString *currencyCode = @"EUR";
    NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:currencyCode] autorelease];
    NSString *currencySymbol = [NSString stringWithFormat:@"%@",[locale displayNameForKey:NSLocaleCurrencySymbol value:currencyCode]];
    NSLog(@"Currency Symbol : %@", currencySymbol);

Thanks.