ifs
Version:
an instant file server that you can run anywhere from the command line
18 lines (16 loc) • 437 B
JavaScript
/*
* file: strings.js
* description: used to provide C# / Python-style format strings to JS string objects
* author: Aaron Stannard
* created: 8/12/2013
* last-modified: 8/12/2013
*/
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
});
};