Action

ROT13 Convert

Posted by @compysando, Last update over 3 years ago - Unlisted

Encrypt/decrypt selected text using ROT13 cypher.

Steps

  • script

    let input = editor.getSelectedText().toLowerCase().split('');
    let output = "";
    let alphabet = "abcdefghijklmnopqrstuvwxyz";
    alphabet = alphabet.split('');
    
    input.forEach(char => {
     let i = alphabet.indexOf(char);
     if (i > -1) {
      let n = i + 13 >= alphabet.length ? i + 13 - alphabet.length : i + 13;
      output += alphabet[n];
     } else {
      output += char;
     }
    });
    
     editor.setSelectedText(output);

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.