string format
String.prototype.format = function()
{
var content = this;
for (var i=0; i < arguments.length; i++)
{
var replacement = '{' + i + '}';
content = content.replace(replacement, arguments[i]);
}
return content;
};
/* use exemple */
a = 'someValue is {0} and anotherValue is {1}'.format('someValue', 'anotherValue'); // Hello world.
$("p.format").text(a);