Here you can find the source of format()
// Format script with example String.prototype.format = function() { var pattern = /\{\d+\}/g; var args = arguments; return this.replace(pattern, function(capture){return args[capture.match(/\d+/)]}); } // var myName = 'John'; // var myText = "hello {0}, how are you??".format(myName); // Place variable in the string.
String.prototype.format=function(){ var args = arguments; return this.replace(/{(\d+)}/g, function(match, number){return typeof args[number] != 'undefined'?args[number]:match;}); };
String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return args[number] != undefined ? args[number] : match; }); };
'use strict'; String.prototype.format = function(){ var args = arguments; return this.replace(/{(\d+)}/g, function(match, index){ return args[index]; }); }; module.exports = String;
String.prototype.format = function() { var formatted = this; for (var arg in arguments) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); return formatted; }; $(document).on("click", "input.click-select", function(e) { $(e.target).select(); ...
"use strict"; String.prototype.format = function () { var args = arguments; return this.replace(/\{(\d+)\}/g, function () { return args[arguments[1]]; }); };
String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; ...
function $log(text, obj) { if (window.console && console.log) { console.log(text); if (obj) { console.log(obj); String.prototype.format = function () { ...
String.prototype.format = function() { var args = [].slice.call(arguments); return this.replace(/%(\d+)/g, function(w, m) { var offset = parseInt(m) - 1; if (args[offset] != undefined) { return String(args[offset]); return w; }); ...
String.prototype.format=function() if(arguments.length==0) return this; for(var s=this, i=0; i<arguments.length; i++) s=s.replace(new RegExp("\\{"+i+"\\}","g"), arguments[i]); return s; };