标签:oat 去掉 veth div string script highlight reg return
一.去掉千分位
function removeThousands(num) { var x = num.split(‘,‘); return parseFloat(x.join("")); }
二.添加千分位
function addThousands(num) { var reg = /\d{1,3}(?=(\d{3})+$)/g; if ( num &&num.toString().indexOf(‘.‘) == -1) { return (num + ‘‘).replace(reg, ‘$&,‘); } else { return num.toString().replace(/(\d)(?=(\d{3})+\.)/g, function ($0, $1) { return $1 + ","; }); } }
标签:oat 去掉 veth div string script highlight reg return
原文地址:https://www.cnblogs.com/muyeh/p/10999348.html