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

前端 未结 9 849
庸人自扰
庸人自扰 2020-12-28 14:55

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,

9条回答
  •  离开以前
    2020-12-28 15:26

    NSNumberFormatter * formatter = [NSNumberFormatter new];
    formatter.numberStyle = NSNumberFormatterCurrencyStyle;
    
    NSString * localeIde = [NSLocale localeIdentifierFromComponents:@{NSLocaleCurrencyCode: currencyCode}];
    formatter.locale = [NSLocale localeWithLocaleIdentifier:localeIde];
    
    NSString * symbol = formatter.currencySymbol;
    

提交回复
热议问题