10,000円とか、値段表記の際に使う数値の3桁区切りを行う関数。
function addFigure(str) {
var num = new String(str).replace(/,/g, "");
while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
return num;
}
Go to list of users who liked
More than 5 years have passed since last update.
10,000円とか、値段表記の際に使う数値の3桁区切りを行う関数。
function addFigure(str) {
var num = new String(str).replace(/,/g, "");
while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
return num;
}
Register as a new user and use Qiita more conveniently
Go to list of users who liked