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
I would actually do it this way. If you decide to do it as SveinnV said it may be that the symbol is place before the 0
amount and then you are just getting @"0"
as the symbol:
- (NSString *) currencySymbolForCurrencyCode:(NSString *) currencyCode
{
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[formatter setMaximumFractionDigits:0];
[formatter setCurrencyCode:currencyCode];
NSString *string = [formatter stringFromNumber:[NSNumber numberWithInt:0]];
NSArray *components = [string componentsSeparatedByCharactersInSet:[NSCharacterSet decimalDigitCharacterSet]];
return [components firstObject];
}