Re: [NTB] Sorting inline numbers
- View SourceHi Amitava,
I have a clip which starts what you want, but you will probably want it
tweaked a bit more.
It uses the kind of raw sorting which considers 116 to be a smaller
number than 18. It works great with alphabetical values but looks wierd
to us with numeric stuff.
I can think of several ways to go from here. Probably the easiest would
be to assign the %temp% variable to an array and writing your own
sorting algorithm (sp?) which gives your prefered value, or this might
get you near enough that you can manually drag and drop your numbers
into order. Course someone else could already have the perfect clip out
H="sort comma delimited list"
^!Set %temp%=^$StrReplace(", ";"^%NL%";^%temp%;FALSE;FALSE)$
^!Set %temp%=^$StrReplace("^%NL%";", ";^%temp%;FALSE;FALSE)$
VSNL MAIL wrote:
As a result, all the numbers in the list are not in any order. I
> have given an example below.
> Damodardeva 18, 69, 100, 366, 111, 213, 261, 370, 116, 153, 303, 363
> Can anybody suggest a clip which would sort the numbers in ascending order.
- View SourceDon't think I'm on the clips list so just replying. This does work, but
again not for numbers. The clip that should precede it would find the
longest number before a comma, count it and add zeros in front of all
others to so that all numbers were the same number of digits. Beyond me.
H="Sort comma delimited list"
^!Replace " " >> "" [HAS]
^!Replace "," >> "^P" [HAS]
^!Keyboard ALT+M L S A
Add from clipboard.
[Non-text portions of this message have been removed]