format currency for specific local in obj c - iphone

i am getting product price in multiple currency. here is a sample data
CurrencyName CurrencySymbol Pirce
"USD", "$" 1234.5
"EUR", "€" 12340.5
"GBP", "£" 123.4
"CHF", "CHF" 12345.0
so i want to format available currency based on type not based iPad/iPhone local format.
for example
$1234.50
1.234,50€
and also i want to display all at a same time.
thanks.

That means you want to show it in different localizations. Like the Euros in French or German (with decimal comma) and the CHF in Swiss (with decimal point and probably and apostrophe for separating the thousands).
I would map the currency to a specific localization and the feed it to the nsnumberformatter.

Related

Flutter compactCurrency for Indian rupees but need to display lakhs, crores in English

I am using NumberFormat.compactCurrency() with HI locale as I want to compact the number in the Indian currency way - into lakhs, crores..etc.
But, if I use HI as the locale in it, it seems to add the lakh/crore string in Hindi. I want to compact the currency in the Indian way but show the lakh/crore in English. Do I need to use a different locale string for that? any other ideas?
The most simple way to get closest to your requirements would be to use  en_IN:
NumberFormat.compactCurrency(locale: 'en_IN').format(price)
Output :

Get currency symbol from currency/country code

I have my app translated to different languages (https://pub.dev/packages/flutter_translate) and I also provide the option to select a specific currency (https://pub.dev/packages/country_currency_pickers):
first 2 options
When I select the currency I get this:
Now that everything is selected I need to update my currency and for that I can do:
NumberFormat.simpleCurrency(
locale: "en_GB",
).format(money);
Notice that I have en_GB which is what I'd need here to display pounds. For this example I get es from the language and GB from the currency but es_GB gets euros instead of pounds, which is what I'd need.
How can I get the country code from any of the previous parameters?
Can I pass something else to get the symbol like currencyCode for example?
You should use provide name in the constructor. https://api.flutter.dev/flutter/intl/NumberFormat/NumberFormat.simpleCurrency.html
If name is specified, the currency with that ISO 4217 name will be used. Otherwise we will use the default currency name for the current locale.
NumberFormat.simpleCurrency(
name: "GBP", //currencyCode
).format(money)

Which states codes have to be used for Srilanka in Paypal?

Can i find the states codes somewhere that have to be used for the Paypal address format ?
Which states codes have to be used for Srilanka?
When you mean the two-character country codes, that would be
lk
Reference: https://www.paypal.com/lk/webapps/mpp/home
They are using the two-digit "alpha 2" country codes as defined in ISO 3166.

How to use different currency symbol instead of device local currency symbol?

I need to give the facility to user that user can use different currency symbol instead of device local currency symbol. For example: If my device language is 'English', then my currency symbol will be '$' but I need to do that my device language will remain 'English' but currency symbol changed to '€'(or any other currency symbol but not '$').
Please do not mark it as duplicate because I need to use different currency symbol instead of device default local currency symbol.
Please give your suggestion regarding this. Thanks for your time.
I use this:
NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyFormatter setCurrencyCode:currencyCode];
where currency code is something like "USD", "CAD", "EUR", "GBP", etc.

number format on Zend Currency

I am developing a site Zend based but I have the followin problem:
$currency = new Zend_Currency();
$currency->toCurrency(20, array('currency' => 'EUR','number_format' => '#0.#'));
Gives me 20,00 EUR but I need 20.00 EUR (that is why i set number_format), Any suggestion?
Try changing number_format to just format.
Excerpt from Zend_Currency Docs in reference to the options array('format' =>'#0.00'): format: Defines the format which
should be used for displaying numbers. This number-format includes for
example the thousand separator. You can either use a default format by
giving a locale identifier, or define the number-format manually. If
no format is set the locale from the Zend_Currency object will be
used.