EmEditor (text editor) Forum Index
   Questions and Answers about EmEditor Core
     sort lines according to their length?
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
zhouzh2
Posted on: 2/26/2012 7:25 pm
Just can't stay away
Joined: 7/27/2008
From:
Posts: 89
Re: sort lines according to their length?
Hi user,
I wrote this macro for you:
document.selection.EndOfDocument(false);
endOfDocu = document.selection.GetActivePointY( eePosView );
document.selection.StartOfDocument(false);
document.selection.EndOfLine(false,eeLineView);
currentCursor = document.selection.GetActivePointY( eePosView );
while ( endOfDocu != currentCursor ) {
	currentCursor = document.selection.GetActivePointY( eePosView );
	numberOfChar = document.selection.GetActivePointX( eePosLogical ) - 1;
	document.selection.StartOfLine(false,eeLineView | eeLineHomeText);
	document.selection.Text=numberOfChar + ": ";
	document.selection.LineDown(false,1);
	document.selection.EndOfLine(false,eeLineView);
}

This macro will add numbers which indicate the number of characters of the line to the start of lines.
After that,you can use the "sort" of emeditor.
Than replace "^\d+?:\s" with NULL to restore orginial line.
Hope it helps.

Cheers,
angus.
user
Posted on: 2/26/2012 7:44 am
Home away from home
Joined: 9/29/2006
From:
Posts: 212
sort lines according to their length?
hello

in Emeditor, there is a feature to sort lines alphabetically or arithmetically, but how can I sort lines according to their length?

thanks!
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文