I need quick solution to convert currency names to currency symbols.
Like I have GBP which I want to convert into Pound symbol through small javascript/jquery code. Data is totally dynamic.
var currency_symbols = { 'USD': '$', // US Dollar 'EUR': '€', // Euro 'CRC': '₡', // Costa Rican Colón 'GBP': '£', // British Pound Sterling 'ILS': '₪', // Israeli New Sheqel 'INR': '₹', // Indian Rupee 'JPY': '¥', // Japanese Yen 'KRW': '₩', // South Korean Won 'NGN': '₦', // Nigerian Naira 'PHP': '₱', // Philippine Peso 'PLN': 'zł', // Polish Zloty 'PYG': '₲', // Paraguayan Guarani 'THB': '฿', // Thai Baht 'UAH': '₴', // Ukrainian Hryvnia 'VND': '₫', // Vietnamese Dong };
I can't use any plugin like currenyformat
.
Looking for quick help.
public final Map<String, String> CURRENCIES= new HashMap<String, String>(){ { put("EUR","€"); put("USD","$"); ... } }; Then, you can get the symbol by using Locale, like this. Show activity on this post. You can simply use this code to get the currency symbol and different currency formats.
The symbol € is called the Euro symbol. The ISO code for the euro is EUR. It is used by 19 member countries of the European Union and the design is based on the Greek letter epsilon (Є).
The symbol for the pound sterling resembles a capital "L" because of the Latin word libra, which means scales or balance. Libra now means a unit of weight equivalent to 12 ounces.
Do this:
var currency_symbols = { 'USD': '$', // US Dollar 'EUR': '€', // Euro 'CRC': '₡', // Costa Rican Colón 'GBP': '£', // British Pound Sterling 'ILS': '₪', // Israeli New Sheqel 'INR': '₹', // Indian Rupee 'JPY': '¥', // Japanese Yen 'KRW': '₩', // South Korean Won 'NGN': '₦', // Nigerian Naira 'PHP': '₱', // Philippine Peso 'PLN': 'zł', // Polish Zloty 'PYG': '₲', // Paraguayan Guarani 'THB': '฿', // Thai Baht 'UAH': '₴', // Ukrainian Hryvnia 'VND': '₫', // Vietnamese Dong }; var currency_name = 'INR'; if(currency_symbols[currency_name]!==undefined) { alert(currency_symbols[currency_name]); }
NOTE: Not every currency has symbol. Only listed above currencies have real symbol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With