Node.js examples for String:Replace
Replace space in string and test
String.prototype.replaceSpaces = function() { var length = this.length; for(var i = 0; i < length; i++) { if(this[i] == ' ') { this[i] = "%20" }/*from w ww . j av a 2 s .c o m*/ } return this.toString(); } console.log("This is my Name".replace(/ /ig, '%20'));