Node.js examples for String:Format
Very basic python style string variable injection
/* Very basic python style string variable injection * /* w w w. j a v a 2s. c o m*/ * "My name is %s, and I am %s".format("Manny", 8) // => "My name is Manny, and I am 8" */ String.prototype.format = function () { var s = this; for (var i=0; i < arguments.length; i++) { s = s.replace( '%s', arguments[i] ); } return s; };