highlanderkev
4/13/2016 - 7:25 PM

String Format Function

String Format Function

//String Format Function
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;
 };
 module.exports.format = String.prototype.format;