Here you can find the source of format()
'use strict';/*www . j a va 2 s. co m*/ String.prototype.format = function() { var content = this; for (var i = 0; i < arguments.length; i++) { var replacement = '{' + i + '}'; content = content.replace(replacement, arguments[i]); } return content; }; String.prototype.toValidId = function() { var content = this; return content.replace(/\s/g, '-'); };
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; };
String.prototype.format = function() { var str = this.toString(); if (!arguments.length) return str; var args = typeof arguments[0], args = (("string" == args || "number" == args) ? arguments : arguments[0]); for (arg in args) str = str.replace(RegExp("\\{" + arg + "\\}", "gi"), args[arg]); return str; ...
String.prototype.format = function () { var result = this.toString(); var arg = arguments.length == 1 && typeof arguments[0] == 'object' ? arguments[0] : arguments; for (var value in arg) { result = result.split('{' + value + '}').join(arg[value]); return result;
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.contains = function (it) { return this.indexOf(it) != -1; }; ...
String.prototype.format = function() { var newStr = this, i = 0; while (/%s/.test(newStr)) { newStr = newStr.replace("%s", arguments[i++]) return newStr;
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; };
String.prototype.format = function () { var formatted = this; for (var arg in arguments) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); return formatted; };
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.replaceAll = function (find, replace) { ...