Skip to content

Instantly share code, notes, and snippets.

@deholic
Created November 19, 2012 02:18
Show Gist options
  • Save deholic/4108616 to your computer and use it in GitHub Desktop.
Save deholic/4108616 to your computer and use it in GitHub Desktop.
String.Format for prototype process
String.format = String.prototype.format = function() {
var i=0;
var string = (typeof(this) == "function" && !(i++)) ? arguments[0] : this;
for (; i < arguments.length; i++)
string = string.replace(/\{\d+?\}/, arguments[i]);
return string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment