javascript format string
http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript Number.prototype.format = function(n, x) { var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\.' : '$') + ')'; return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,'); };
카테고리 없음
2014. 8. 19. 15:34