Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert currency names to currency symbol [closed]

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.

like image 839
richa_pandey Avatar asked Oct 15 '13 05:10

richa_pandey


People also ask

How do you make the currency symbol?

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.

What is the currency that looks like an E?

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 (Є).

What does the L symbol mean in money?

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.


1 Answers

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.

like image 94
Vin.AI Avatar answered Sep 20 '22 21:09

Vin.AI