My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen displays just the currency symbol. Rather than storing both the currency cod
The following code will return only the currencySymbol for a given currencyCode
- (NSString*)getCurrencySymbolFromCurrencyCode:(NSString*)currencyCode {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setCurrencyCode:currencyCode];
[formatter setMaximumFractionDigits:0];
NSString *string = [formatter stringFromNumber:[NSNumber numberWithInt:0]];
[formatter release];
return [string substringFromIndex:1];
}