Here you can find the source of format()
'use strict';/*from www .j a v a 2 s . co m*/ /** * Atacama utility module for shared functions */ // http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery String.prototype.format = function () { var args = arguments; return this.replace(/\{(\d+)\}/g, function (m, n) { return args[n]; }); }; String.prototype.escapeRegExp = function () { return this.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); }; var A = (function () { var test = function () { console.log("functions.js working"); }; var toVmProperty = function(property) { return 'vm.' + property; }; var isInvalid = function(value) { var isUndefined = (value === undefined); var isInvalidDate = !isUndefined && (value.toString() === 'Invalid Date'); return isUndefined || isInvalidDate; }; return { test: test, toVmProperty: toVmProperty, isInvalid: isInvalid }; })();
String.prototype.format = function () { var o = Array.prototype.slice.call(arguments); return this.replace(/{([^{}]*)}/g, function (match, capture) { var r = o[capture]; return (typeof r === 'string' || typeof r === 'number') ? r : match; ); }; ...
String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function(orig,num) { return typeof args[num] != 'undefined' ? args[num] : orig; }); };
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 placeholderREG = /\{(\d+)\}/g; var args = arguments; return this.replace(placeholderREG, function(holder, num) { return args[num]; });
String.prototype.format = function() { var formatted = this; for( var arg in arguments ) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); return formatted; }; function assert(condition, msg) { if (!condition) { ...
String.prototype.format = function() { var source = this; for (var i = 0; i <= arguments.length - 1; i++) { var reg = new RegExp("\\{" + i + "\\}", "gm"); source = source.replace(reg, arguments[i]); return source; }; Date.prototype.format = function (fmt) { ...
String.prototype.format = function() { var formatted = this; for (arg in arguments) { formatted = formatted.replace('{' + arg + '}', arguments[arg]); return formatted; };
String.prototype.format = function() { var args = arguments; return this.replace(/\{(\d+)\}/g, function(m, i) { return args[i]; }); }; String.prototype.encodeHTML = function () { var s = this.valueOf(); ...
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 () { ...