浮点类型加千分符
NumberToMoney(num) {
return num.replace(/(\d+?)(?=(\d{3})+(\.|$))/g,"$1,");
}
去掉千分符,变为浮点类型
moneyToNumber(s) {
return parseFloat(s.replace(/[^\d.-]/g, ""));
}
NumberToMoney(num) {
return num.replace(/(\d+?)(?=(\d{3})+(\.|$))/g,"$1,");
}
moneyToNumber(s) {
return parseFloat(s.replace(/[^\d.-]/g, ""));
}
本文标题:浮点类型加千分符和还原为浮点类型
本文链接:https://www.haomeiwen.com/subject/nxdgbqtx.html
网友评论