Replace tab in a String - Node.js String

Node.js examples for String:Replace

Description

Replace tab in a String

Demo Code

String.prototype.adjustTab = function() {
  var pattern = /[\t]+/g;
  var tabStripped = this.replace(pattern, " ");
  if (tabStripped.charAt(0) == " ") {
    return tabStripped.substring(1);
  }//w w  w.  j ava2  s. c om
  return tabStripped;
}

Related Tutorials