List of utility methods to do Number Format
numberFormat()String.prototype.numberFormat = function() { return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,'); }; | |
numberWithCommas()String.prototype.numberWithCommas = function () { if (typeof parseFloat(this) === "number") { thiss = (Math.round((this) * 100) / 100).toString(); var dotLastIndex = this.lastIndexOf("."); if (dotLastIndex === -1) { thiss = this + ".00" } else { var decimal = this.substring(dotLastIndex+1); var nonDecimal = this.substring(0, dotLastIndex); ... |