// 将千分符格式的金额数字转化成普通格式的数字
function delcommafy(num){
num = num.toString();
num = num.replace(/,/gi, '');
return num;
}
//转为千分位形式
function comdify(n) {
let re = /\d{1,3}(?=(\d{3})+$)/g;
let n1 = n.replace(/^(\d+)((\.\d+)?)$/, function(s, s1, s2) {
return s1.replace(re, "$&,") + s2;
});
return n1;
}
网友评论