数字转为千分位符
function ThousandAndDecimal(num) {
debugger;
if(num) {
return parseFloat(num).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
} else {
return '0.00'
}
}
千分位符转为数字
function remoney(s) {
let str = ''
if (s) {
str = String(s).replace(/,/g, "")
}
if (s && (s + "").indexOf('.') > -1 && Number(str)) {
return String(s).replace(/[^\d\.-]/g, "");
} else if (s && Number(str)) {
return str;
} else {
return s
}
}
转载地址: