Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # IT:AD:JScript:Strings # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} --- #### String.Format Equivalent: String.prototype.format = function () { var args = arguments; return this.replace(/{(\d+)}/g, function (match, number) { return typeof args[number] != 'undefined' ? args[number] : match; }); }; //usage: return "A {0}{1} example.format("very","quick"); ## Equivalent of String.Format ## String.prototype.format = function() { var formatted = this; for(arg in arguments) { formatted = formatted.replace("{" + arg + "}", arguments[arg]); } return formatted; }; /home/skysigal/public_html/data/pages/it/ad/jscript/strings.txt Last modified: 2023/11/04 22:28by 127.0.0.1