Get currency symbols from currency code with swift

前端 未结 11 623
星月不相逢
星月不相逢 2020-12-24 12:21

How can I get the currency symbols for the corresponding currency code with Swift (macOS).

Example:

  • EUR = €1.00
  • USD = $1.00<
11条回答
  •  时光取名叫无心
    2020-12-24 13:07

    You can try this:

    let formatter = NSNumberFormatter()
    
    for locale in NSLocale.availableLocaleIdentifiers() {
        formatter.locale = NSLocale(localeIdentifier: locale)
        print("\(formatter.currencyCode) =  \(formatter.currencySymbol)")
    }
    

提交回复
热议问题