百度网上转金额的函数都太差了,本身写了一个,性能和代码量都好些的bash
function toPrice (price) { return Number(price || 0).toFixed(2).toString().replace(/\d+(?=(\d{3})+\.\d{2}$)/g, '$&,') } const num = 2333333; num.toLocaleString(); 复制代码