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 };