Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Pad selected lines with spaces up to the given pad length
- // Cut selected text into array selectedLines, separating lineEnd
- // include cutSelection.js
- var padLength = 1*UltraEdit.getString("Pad to length",1);
- if (padLength<=0) {
- padLength = Math.max.apply( null, selectedLines.map(
- function( line ) { return line.length } )
- );
- }
- var spaces = Array( padLength + 1).join(' ');
- var result = selectedLines.map( function( line ) {
- return (line + spaces).substring(0,padLength);
- } ).join( lineEnd );
- UltraEdit.activeDocument.write( result );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement