List of utility methods to do Number Format Pad
zeroPad(len)Number.prototype.zeroPad = function (len) { var s = String(this); var c = '0'; len = len || 2; while (s.length < len) { s = c + s; return s; }; ... | |
zeropad(n)Number.prototype.zeropad = function(n) { var str = "" + this; var len = n - str.length; var pad = ""; while (len-- > 0) { pad += "0"; return pad + str; }; ... | |
zf(len)Number.prototype.zf = function(len){ if(isNaN(len)) len = 2; return (this + '').pad(len, '0'); }; | |
zfill(length)Number.prototype.zfill = function(length) { var str = this.toString(); if (str.length < length) { for(var i = 0; i < length - str.length; i++) str = '0' + str return str; }; | |
zfill(n)Number.prototype.zfill = function (n) { var str = String(this); while (str.length < n) { str = "0" + str; return str; }; |