整数缝三
function fnInttrunt(number) { let intPart = Number(number)|0; //获取整数部分 return intPart.toString().replace(/(d)(?=(?:d{3})+$)/g, '$1,') }
小数逢三
function fnfloattrunt(number) { let intPart = Number(number); return intPart.toString().replace(/d(?=(d{3})+.)/g,'$&,'); }