Javascript String decode()

Description

Javascript String decode()


String.prototype.decode = function() {
 var regExp = "%26#([0-9]*);";
 var thisStr = this;
 while (true) {/*from ww w.jav a 2  s  .  c o  m*/
  var data = thisStr.match( unescape(regExp) );
  if (!data) break;
  thisStr = thisStr.replace( data[0], String.fromCharCode( data[1] ) );
 }
 return thisStr;
}



PreviousNext

Related