forked from sheetjs/sheetjs
7 lines
203 B
JavaScript
7 lines
203 B
JavaScript
function commaify(s/*:string*/)/*:string*/ {
|
|
if(s.length <= 3) return s;
|
|
var j = (s.length % 3), o = s.substr(0,j);
|
|
for(; j!=s.length; j+=3) o+=(o.length > 0 ? "," : "") + s.substr(j,3);
|
|
return o;
|
|
}
|