标签:格式 获取 ring javascrip oat att ber pre attr
整数缝三
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,‘$&,‘); }
标签:格式 获取 ring javascrip oat att ber pre attr
原文地址:https://www.cnblogs.com/xiaolanschool/p/11148869.html