samuelsimoes
7/30/2014 - 3:47 PM

gistfile1.js

// "{0} isso é um {1}".format('Olar', 'teste')
if (!String.prototype.format) {
  String.prototype.format = function() {
    var args = Array.prototype.slice.call(arguments);

    return this.replace(/{(\d+)}/g, function(match, number) {
      return (args[number] ? args[number] : match);
    });
  };
}