Is there a C# String.Format() equivalent in JavaScript? -


this question has answer here:

c# has powerful string.format() replacing elements {0}with parameters. javascript have equivalent?

try sprintf() javascript.

or

// first, checks if isn't implemented yet. if (!string.prototype.format) {   string.prototype.format = function() {     var args = arguments;     return this.replace(/{(\d+)}/g, function(match, number) {        return typeof args[number] != 'undefined'         ? args[number]         : match       ;     });   }; }  "{0} dead, {1} alive! {0} {2}".format("asp", "asp.net") 

both answers pulled javascript equivalent printf/string.format


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -