Here you can find the source of format()
/* global $ *//*from ww w. j av a 2 s . c o m*/ 'use strict'; 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|\d\d)\}/g, function ( $0 ) { var idx = $0.match(/\d+/); return args[idx] ? args[idx] : $0 ; } ); "T123{0}T{0}".format("A","B") ...
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; }; function selectElementText(el) { ...
String.prototype.format = function() { var args = arguments; return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function(m, n) { if (m == "{{") { return "{"; if (m == "}}") { return "}"; return args[n]; }); }; String.prototype.html = function() { return $('<i></i>').text(this).html(); }; String.prototype.htmlWithLines = function() { var text = this.html(); return text.replace(/\n/g, '<br/>'); function loc () { var code = arguments[0]; var text = l[code]; if (text != null) { var params = [] ; for (var i = 1 ; i < arguments.length ; i++) { params.push(arguments[i]); return text.format (params); } else { return "##" + code + "##";
function generateUUID(){ var d = new Date().getTime(); if(window.performance && typeof window.performance.now === "function"){ d += performance.now(); var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = (d + Math.random()*16)%16 | 0; d = Math.floor(d/16); return (c=='x' ? r : (r&0x3|0x8)).toString(16); ...
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 lz(n){ ...
String.prototype.format = function () { var args = [].slice.call(arguments); return this.replace(/(\{\d+\})/g, function (a) { return args[+(a.substr(1, a.length - 2)) || 0]; }); }; var self = { clone: function clone(a) { return JSON.parse(JSON.stringify(a)); ...
String.prototype.format = function() { var args = arguments; return this.replace(/\$\{([A-Za-z0-9_]+)\}/g, function(base, element, position) { for (var i = 0; i < args.length; i++) { var arg = args[i]; if (arg && typeof(arg) == "object") { try { if (arg[element] !== undefined) return arg[element]; ...
String.prototype.format = function () { var args = arguments; this.unkeyed_index = 0; return this.replace(/\{(\w*)\}/g, function (match, key) { if (key === '') { key = this.unkeyed_index; this.unkeyed_index++ if (key == +key) { ...
'use strict'; String.prototype.format = function () { var str = this; for (var i = 0; i < arguments.length; i++) { var regEx = new RegExp("\\{" + (i) + "\\}", "gm"); str = str.replace(regEx, arguments[i]); return str;