Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript get currency symbol by currencyCode

var str1 = '10,00 fr';
var str2 = '12.22 $';

function getCurrencySymbol(str) {
  //replace all numbers, spaces, commas, and periods with an empty string
  //we should only be left with the currency symbols
  return str.replace(/[d., ]/g, '');
}

console.log(getCurrencySymbol(str1));
console.log(getCurrencySymbol(str2));
Comment

javascript get currency symbol by currencyCode

var str1 = '10,00 €';
var str2 = '12.22 $';

function getCurrencySymbol(str) {
  //replace all numbers, spaces, commas, and periods with an empty string
  //we should only be left with the currency symbols
  return str.replace(/[d., ]/g, '');
}

console.log(getCurrencySymbol(str1));
console.log(getCurrencySymbol(str2));
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript regex match sequence 
Javascript :: angular 11 features 
Javascript :: filter method javascript 
Javascript :: js phone number validation 
Javascript :: loop through async javascript -3 
Javascript :: how to get firebase document id angular 
Javascript :: print in javascript 
Javascript :: mongoose add new field to schema 
Javascript :: react testing library 
Javascript :: find string length javascript 
Javascript :: private route in react js 
Javascript :: 1 line password strength checker jquery 
Javascript :: js 1 minute sleep 
Javascript :: javascript prevent value change in select option 
Javascript :: node fs 
Javascript :: js split string 
Javascript :: call a function 
Javascript :: django csrf failed ajax case 
Javascript :: get numbers from a string 
Javascript :: react hook usestate 
Javascript :: for of and for in javascript 
Javascript :: vbscript popup message box with timer 
Javascript :: trigger sweet alert through javascript 
Javascript :: angular dropdown selected value 
Javascript :: change cover photo with javascript 
Javascript :: videojs videoJsResolutionSwitcher youtube 
Javascript :: jquery check component exists 
Javascript :: javascaript 
Javascript :: supertest formdata 
Javascript :: express send image bufffer 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =