用逗号分隔数据222,333.55

function   formatNumWithDot (val) {
                var a = (val+"").indexOf(".")
                if (a > -1) {
                    var b = (val + "").split(".")
                    return (b[0] || 0).toString().replace(/(d)(?=(?:d{3})+$)/g, '$1,') + "." + b[1];
                } else {
                    return (val || 0).toString().replace(/(d)(?=(?:d{3})+$)/g, '$1,');
                }
            },
原文地址:https://www.cnblogs.com/liuhao-web/p/8340149.html