Nodejs String Rot13 rot13()

Here you can find the source of rot13()

Method Source Code

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require jquery_rotate
//= require hero_remark
//= require turbolinks

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 a  v a 2s . co  m
};

Related

  1. 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);
      });
    };
    
  2. rot13()
    var mail = "asdf@asdf.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);
      });
    };
    
  3. 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));
      });
    };
    var includeEmailLink = function () {
      var anchor = document.getElementById('hello');
      var href = anchor.getAttribute('href');
      return anchor.setAttribute('href', href.rot13());
    ...
    
  4. 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);
      });
    };
    
  5. rot13(s)
    String.prototype.rot13 = function(s)
        return (s ? s : this).split('').map(function(_)
            if (!_.match(/[A-za-z]/)) return _;
            c = Math.floor(_.charCodeAt(0) / 97);
            k = (_.toLowerCase().charCodeAt(0) - 83) % 26 || 26;
            return String.fromCharCode(k + ((c == 0) ? 64 : 96));
         }).join('');
    ...
    
  6. rot13(str)
    function rot13(str) { 
        var arr = [];
        for (var i = 0; i < str.length; i++) {
            if (str.charCodeAt(i) < 65 || str.charCodeAt(i) > 90) {
                arr.push(str.charAt(i));
            } else if (str.charCodeAt(i) > 77) {
                arr.push(String.fromCharCode(str.charCodeAt(i) - 13));
            } else {
                arr.push(String.fromCharCode(str.charCodeAt(i) + 13));
    ...