Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can we write any currency symbol in visual studio?

I am working on a WebApp using React and have to use various currency symbols but dollar symbol is provided to us in keyboard only. So, how could i use differnt currency sysmbols?
Is there some solution common to all platforms or specific one for VS code?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You need to install this library

currency-symbol

Example

//ES5
const currencySymbol = require('currency-symbol');
 
// ES6
import currencySymbol from 'currency-symbol';
 
console.log(currencySymbol.all());
// This will return all curriencies symbol
 
console.log(currencySymbol.symbol("United States")); //$
// This will return '$' which is $.
 
console.log(currencySymbol.symbol("USD")); //$
// This will return '$' which is $.
 
console.log(currencySymbol.symbol("Dollar")); //$
// This will return '$' which is $.
 
console.log(currencySymbol.symbol("Nigeria")); //₦
// This will return '₦' which is ₦.
 
console.log(currencySymbol.symbol("NGN")); //₦
// This will return '₦' which is ₦.
 
console.log(currencySymbol.symbol("Naira")); //₦
// This will return '₦' which is ₦.
 
console.log(currencySymbol.symbol("GHC")); //¢
// This will return '¢' which is ¢
 
console.log(currencySymbol.symbol("Ghana")); //¢
// This will also return '¢' which is ¢
 
console.log(currencySymbol.symbol("Cedis")); //¢
// This will also return '¢' which is ¢.
 
/***
* Note: the .symbol() function takes any of this arguments - Country Name, Currency Name and Currency Abbreviation and return the currency symbol.
***/

You need to use above library or use code like this for related currency like this $ for dollar

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading