Javascript String clean()
String.prototype.clean = function clean () { return this.replace(/ +/gi, ' ').trim(); };
String.prototype.clean = function() { str = this.replace(/'/g, '').replace(/\s/g, '').replace(/_/g, ''); return str;//from w ww. j av a 2s.c o m };