Javascript String keyslug()

Description

Javascript String keyslug()

// array keyslug/* w  ww. j av  a  2 s.  co m*/
String.prototype.keyslug=function(){
   return this.toLowerCase().replace(/\s/g,'_').replace(/[^a-zA-Z0-9]/g,'_').replace(/_{2,}/g,'_').replace(/^_/,'').replace(/_$/,'');
}



PreviousNext

Related