Javascript String rot13()

Description

Javascript String rot13()


String.prototype.rot13 = function(){
  return this.replace(/[a-zA-Z]/g, function(c){
    return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
  });// w  w w .j  av  a2  s  .co m
};

Javascript String rot13()

var mail = "adf@hotmail.pbz"
String.prototype.rot13 = function(){
  return this.replace(/[a-zA-Z]/g, function(c){
    return String.fromCharCode((c <= "Z" ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
  });/*from   w ww . ja  va2  s  .co  m*/
};



PreviousNext

Related