function formatThousand(num) {
    num = num + "";
    var reg = /(-?\d+)(\d{3})/;
    while (reg.test(num)) {
        var temp = num.replace(reg, "$1,$2");
        if (num.indexOf(".") >= 0 && temp.split(".")[1].length > num.split(".")[1].length) {
            break;
        }
        num = temp;
    }
    return num;
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
  • 2022-01-16
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
  • 2021-08-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-28
  • 2022-02-01
  • 2021-12-23
  • 2021-06-24
  • 2022-12-23
相关资源
相似解决方案