Action
Sort
Sort lines in alpha order.
Steps
-
script
// sort methods function alphaSort(vals, caseSensitive, ascending) { let result = vals.sort(function(a, b) { if (!caseSensitive) { a = a.toLowerCase(); b = b.toLowerCase(); } return a.localeCompare(b); }); if (!ascending) { result = result.reverse(); } return result; } // Alpha sort selected lines. let lnRange = editor.getSelectedLineRange(); let ln = editor.getTextInRange(lnRange[0],lnRange[1]); let lines = alphaSort(ln.split('\n'), true, true); editor.setTextInRange(lnRange[0],lnRange[1],lines.join('\n'));
Options
-
After Success Default Notification Error Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.