Remove Underscore And Dash - Node.js String

Node.js examples for String:Replace

Description

Remove Underscore And Dash

Demo Code


String.prototype.removeUnderscoreAndDash = function () {
  var intString = this;
  for(var k=0; k < intString.length; k++)
  {/* w  ww  .ja  v a  2  s  .  c o  m*/
    if(intString[k] == '-' || intString[k] == '_'){
       intString = intString.substr(0,k)+" "+intString.substr(k+1,intString.length);
    }
  }
  return intString;
}

String.prototype.prettyString = function () {
  return this.removeUnderscoreAndDash().ucFirstAll();
}

Related Tutorials