Action
Sarcasm Case
                  
        Posted by themgineer,
    Last update
    about 1 year ago
    UPDATES
about 1 year ago
Added missing semicolon
Converts selected text to sarcasm case (alternating upper and lower case letters). The script will skip non-letter characters.
Steps
- 
    
script
const regex = new RegExp('[a-z]'); let selectedText = editor.getSelectedText().toLowerCase(); let textArray = selectedText.split(''); let toggle = true; for (let i = 0; i < textArray.length; i++) { if (!regex.test(textArray[i])) { continue; } if (toggle) { textArray[i] = textArray[i].toUpperCase(); toggle = false; } else { textArray[i] = textArray[i].toLowerCase(); toggle = true; } } let sarcasm = textArray.join(''); draft.append(sarcasm); 
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.