objective c - How to set iOS NSNumberFormatter locale via currency code? -


The

There is a NSNumberFormatter through the setting NSLocale to One way is to use "USD" instead of "en_US" at any point of the local setting like the currency code

instead of the locale identifier in iOS?

I see a NSLocaleCurrencyCode object, but I'm not sure that I can use NSNumberFormatter's which method to set locale it Am I

Edit: For more clarification about what I am doing, I will copy the country's currency code (USD, GBP, JPY, CNY, etc ... ) A list of The user's choice is the currency he is using through these codes, and then I want NSNumberFormatter to automatically set its position to the location of that currency to automatically format it.

You can not set a specific location with the currency code.

For example, places which currency code number of USD 27, and NSNumberFormatter 7 these changes with NSLocale with formatted emissions strings:

  "$ 123,456.78": [en_PR, es_US, en_MH, chr_US, en_AS, en_MP, es_SV, en_VG, en_VI, es_PR, haw_US, en_IO, en_UM, en_US , en_DG, en_GU] "US $ 123,456.78": [en_PW, sn_ZW, en_ZW, en_TC, nd_ZW, en_FM] "$ 123.456,78": [es_EC] "123 456,78 US $": [pt_TL] "$ 123,456.78" : [en_US_POSIX] "$ 123.456,78": [nl_BQ] "$ 123,456.78": [lkt_US]  

If you want you want to do a lookup by Table should be maintained a.

  Go 2locale = ["USD": NSLocale (localeIdentifier: "en_US"), "GBP": NSLocale (Locale Identifier: "en_GB"), "JPY": NSLocale (locale identifier: "ja_JP "), ...]  

Comments