Sort alpha & numeric

Post Reply
BBServ
Posts: 14
Joined: 01.04.2021 17:20

Sort alpha & numeric

Post by BBServ »

Is there a way to sort numbers mixed with text and keep the numbers in proper order? I can do this with Notepad++.

Example Text sorted as desired:
a1
a2
a5
a9
a12
a44

With Cuda I get:
a1
a12
a2
a44
a5
a9
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Sort alpha & numeric

Post by main Alexey »

There is a way.
Call "Plugins / Sort / Sort dialog" (plugin).
In that dialog

- check "Numeric"
- change "Sort only by substring / From" to 1

'From'=1 because we have one 'a' letter at start.
If you have 'aaa' at start, then 'From' must be 3.
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: Sort alpha & numeric

Post by main Alexey »

I made change to 'Sort' plugin. you can download / replace files from
https://github.com/Alexey-T/CudaText/tr ... /cuda_sort

change is:
+ add: plugin Sort: 'Numeric' option handles leading letters too, e.g. line 'before123after' will be treated as tuple ('before', 123, 'after')

so, for your text, you don't need to set 'From'/'To' anymore. only check the 'Numeric' option.
BBServ
Posts: 14
Joined: 01.04.2021 17:20

Re: Sort alpha & numeric

Post by BBServ »

Works perfectly - thanks
Post Reply