概述
金额添加千分位
regExp(cellValue) {
if (cellValue !== null) {
cellValue = Number(cellValue).toFixed(2); //小数点后两位
cellValue += "";
if (!cellValue.includes(".")) cellValue += ".";
return cellValue
.replace(/(d)(?=(d{3})+.)/g, function ($0, $1) {
return $1 + ",";
})
.replace(/.$/, "")
}
},
金额去除千分为位
delcommafy(num) {
if (num != undefined) {
num = num.toString();
num = num.replace(/[ ]/g, ""); //去除空格
num = num.replace(/,/gi, '');
return Number(num);
}
},
最后
以上就是爱笑冥王星为你收集整理的金额添加千分位的全部内容,希望文章能够帮你解决金额添加千分位所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复