Here you can find the source of format()
// Add in commas for a value String.prototype.format = function(){ return this.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,"); };
String.prototype.format = function(){ var fn = String.format; switch (arguments.length) { case 1: return fn(this, arguments[0]); case 2: return fn(this, arguments[0], arguments[1]); case 3: return fn(this, arguments[0], arguments[1], arguments[2]); ...
String.prototype.format = function () { var str = this, args = arguments; return str.replace(String.prototype.format.regex, function(item) { var intVal = parseInt(item.substring(1, item.length - 1)), replace; if (intVal >= 0) { replace = args[intVal]; } else if (intVal === -1) { ...
String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; ...
'use strict'; String.prototype.format = function() { var self = this; for(var i = 0; i < arguments.length; i += 1) { var reg = new RegExp("\\{" + i + "\\}", "gm"); self = self.replace(reg, arguments[i]); return self; }; ...
String.prototype.format = function() { var args = arguments; return this.replace(/\$\{p(\d)\}/g, (match, id) => { return args[id] }) String.prototype.sid = function() { return `${this.substring(0, 7)}...`
String.prototype.format = function() { var formatted = this; for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('%'+i, 'gi'); formatted = formatted.replace(regexp, arguments[i]); return formatted; };
String.prototype.format = function() { "use strict"; var e = this.toString(); if (!arguments.length) { return e; var t = typeof arguments[0], n = "string" == t || "number" == t ? Array.prototype.slice.call(arguments) : arguments[0]; for (var i in n) { ...
String.prototype.format = function() { var formatted = this; for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{'+i+'\\}', 'gi'); formatted = formatted.replace(regexp, arguments[i]); return formatted; }; function pad(n) { ...
String.prototype.format = function() { s = this; if (arguments.length == 1 && arguments[0].constructor == Object) { for (var key in arguments[0]) { s = s.replace(new RegExp("\\{" + key + "\\}", "g"), arguments[0][key]); } else { for (var i = 0; i < arguments.length; i++) { s = s.replace(new RegExp("\\{" + (i+1) + "\\}", "g"), arguments[i]); ...