sheetjs_sheetjs/packages/ssf/bits/56_commaify.js
2022-03-09 06:28:19 -05:00

8 lines
215 B
JavaScript

function commaify(s/*:string*/)/*:string*/ {
var w = 3;
if(s.length <= w) return s;
var j = (s.length % w), o = s.substr(0,j);
for(; j!=s.length; j+=w) o+=(o.length > 0 ? "," : "") + s.substr(j,w);
return o;
}