This is driving me nuts. I believe I asked this exact same question, but I can\'t find it any more (I used Stack Overflow search, Google Search, manually searched my po
I just started porting Java's String.format() to JavaScript. You might find it useful too.
It supports basic stuff like this:
StringFormat.format("Hi %s, I like %s", ["Rob", "icecream"]);
Which results in
Hi Rob, I like icecream.
But also more advanced numberic formatting and date formatting like:
StringFormat.format("Duke's Birthday: %1$tA %1$te %1$tB, %1$tY", [new Date("2014-12-16")]);
Duke's Birthday: Tuesday 16 December, 2014
See for more in the examples.
See here: https://github.com/RobAu/javascript.string.format