📌  相关文章
📜  javascript 通过currencyCode 获取货币符号 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:57.987000             🧑  作者: Mango

代码示例2
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));