Here you can find the source of format()
function log(s){ if(console)/* w w w.java 2 s. co m*/ console.log(s); } function callStack(){ log(new Error().stack); } /* String.format = function() { var s = arguments[0]; for (var i = 0; i < arguments.length - 1; i++) { var reg = new RegExp("\\{" + i + "\\}", "gm"); s = s.replace(reg, arguments[i + 1]); } return s; } */ String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); };
function clearStorage() { localStorage.clear(); setIcon(); function setIcon() { String.prototype.format = function() { var formatted = this; for (var i = 0; i < arguments.length; i++) { ...
String.prototype.format = String.prototype.f = function () { var s = this, i = arguments.length; while (i--) { s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); return s; };
String.prototype.format = function() var result = this; for (var ix = 0; ix < arguments.length; ix++) var tagRegExp = new RegExp("\\{" + ix + "\\}", "gi"); result = result.replace(tagRegExp, arguments[ix]); 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; }; function isNullOrWhitespace(input) { ...
String.prototype.format= function(){ var args = arguments; return this.replace(/\{(\d+)\}/g,function(s,i){ return args[i]; });
'use strict' String.format = String.f = function () { var s = arguments[0] for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{' + i + '\\}', 'gm') s = s.replace(regexp, (arguments[i + 1] === null ? '' : arguments[i + 1])) return s String.prototype.format = String.prototype.f = function () { var s = this for (var i = 0; i < arguments.length; i++) { var regexp = new RegExp('\\{' + i + '\\}', 'gm') s = s.replace(regexp, (arguments[i] === null ? '' : arguments[i])) return s
String.prototype.format = function () { var args = arguments; return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n) { if (m == "{{") { return "{"; } if (m == "}}") { return "}"; } return args[n]; }); };
function package(nspace) var nspaceComponents = nspace.split("."); var parent = window; for (var i = 0; i < nspaceComponents.length; ++i) { if (typeof parent[nspaceComponents[i]] === "undefined") { parent[nspaceComponents[i]] = {}; parent = parent[nspaceComponents[i]]; ...
String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; ...