Javascript String slim(spacer)

Description

Javascript String slim(spacer)

String.prototype.slim = function (spacer) {
  spacer = spacer || ' ';
  var str = this.replace(/\s+/g, spacer);
  return str;//w ww . ja  v  a  2 s .c om
};



PreviousNext

Related