Javascript String normalize() method

Description

Javascript String normalize() method


String.prototype.normalize = function(){
  return this.trim().replace(/\s{2,}/g, ' ');
};

Javascript String normalize()

String.prototype.normalize = function () {
    return this.replace(/-/g, ' ').capitalize();
};

Javascript String normalize()

String.prototype.normalize = function () {
 return this.replace(/\W/g, "");
}

Javascript String normalize()

String.prototype.normalize = function(){
    return this.replace(/\<[\/a-z \"=]*\>|\n/g,' ').toLowerCase();
}



PreviousNext

Related