Format plugin
- Author
- Message
-
Offline
- Posts: 1862
- Joined: Mon Aug 06, 2007 1:07 pm
- Contact:
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
I did LinesSort.js, but buttons instead of boxes were not good.Infocatcher wrote:I think, for remove/extracts lines and reverse order should used buttons.
-
Offline
- Posts: 119
- Joined: Sat Jan 12, 2008 10:16 am
- Location: Shantou, China
Seperator by any character(s) instead of "\r" only
How about make Seperator by any character(s) instead of "\r" only?
Example - Seperator ";" for following:
Sort by StringAscending, and then I get:
Example - Seperator ";" for following:
Code: Select all
*.rar;*.zip;*.ace;*.arc;*.arj;*.jar;*.cab;*.7z;*.lzh;*.tar;*.bz2;*.gz;*.uha;*.sqx;*.kgb;*.dir;*.uue;*.xxe;*.deb;*.gzip;*.uc2;*.sbc;*.pak;*.tgz;*.bgz
Code: Select all
*.7z;*.ace;*.arc;*.arj;*.bgz;*.bz2;*.cab;*.deb;*.dir;*.gz;*.gzip;*.jar;*.kgb;*.lzh;*.pak;*.rar;*.sbc;*.sqx;*.tar;*.tgz;*.uc2;*.uha;*.uue;*.xxe;*.zip
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Re: Seperator by any character(s) instead of "\r"
I think you should use Replace.cnnnc wrote:How about make Seperator by any character(s) instead of "\r" only?
Main menu -> Edit -> Replace...
What: \n
With: ;
Select Esc-sequences, and then press Replace all.
All line-end characters will be replaced by a semicolon.
-
Offline
- Posts: 119
- Joined: Sat Jan 12, 2008 10:16 am
- Location: Shantou, China
Re: Seperator by any character(s) instead of "\r"
You get me wrong.KDJ wrote:I think you should use Replace.
...
As you mean if I want to sort my string, I have to replace ";" with "\r", and then sort it, finally replace "\r" back to ";".
But my string only in one line, and I just want to get a "aTxt" like this:
Code: Select all
var pSeperator = ";";
// ...
aTxt = AkelPad.GetSelText(1 /*\r*/).split(pSeperator);
Code: Select all
aTxt = AkelPad.GetSelText(1 /*\r*/).split("\r");
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Re: Seperator by any character(s) instead of "\r"
LinesSort.js script is designed to sort lines, and not to sort the words contained between any separators.cnnnc wrote:You get me wrong...
Therefore, as separator of strings used newline character (\r or \n).
Maybe, on the basis of LinesSort.js, I'll write a script to sort words (eg. WordsSort.js).
Meanwhile, you can deal with, replacing semicolons with end-line characters and vice versa.
Original string:
Code: Select all
*.zip;*.arj;*.7z;*.rar
Code: Select all
*.zip
*.arj
*.7z
*.rar
Code: Select all
*.7z
*.arj
*.rar
*.zip
Code: Select all
*.7z;*.arj;*.rar;*.zip
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Re: Seperator by any character(s) instead of "\r"
Well, the script is almost ready.
Sorting strings contained between the semicolons:
Sorting strings contained between the semicolons:
Code: Select all
AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/;/g, "\r"), 1);
AkelPad.Call("Format::LineSortStrAsc");
AkelPad.ReplaceSel(AkelPad.GetSelText().replace(/\r/g, ";"), 1);
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
cnnnc
I wrote ListSort.js script that sorts lists separated with any separator, in each line, by using Format plugin.
I wrote ListSort.js script that sorts lists separated with any separator, in each line, by using Format plugin.
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
cnnnc
In ListSort.js I changed the action of Undo/Redo. Now it is compatible with AkelPad.
In ListSort.js I changed the action of Undo/Redo. Now it is compatible with AkelPad.