Hi everybody,
I have a list with the following words:
( "P16XYZ" "P20DGSgs" "P2GSDyh" "P1HHHye" "P11AXSss" "P45HHHhj" "P14AXCGs" "P3TYR")
(acad_strlsort (list "P16XYZ" "P20DGSgs" "P2GSDyh" "P1HHHye" "P11AXSss" "P45HHHhj" "P14AXCGs" "P3TYR"))
gives me the result as:
("P11AXSss" "P14AXCGs" "P16XYZ" "P1HHHye" "P20DGSgs" "P2GSDyh" "P3TYR" "P45HHHhj")
In the above case, though there is "P1HHHye", "P2GSDyh", "P3TYR" and "P45HHHhj", these did not appear at the start of the sorted list.
I wanted it to be this way:
("P1HHHye" "P2GSDyh" "P3TYR" "P45HHHhj" "P11AXSss" "P14AXCGs" "P16XYZ" "P20DGSgs")
The numeric values are also sorted in the same way:
Sorting of ("1" "3" "6" "22" "11" "111" "12") using acad_strlsort gives ("1" "11" "111" "12" "22" "3" "6"). I wanted it to be ("1" "3" "6" "11" "12" "22" "111").
Can any one help me to do some advanced sorting to get the ideal output that will have string numbers sorted according to their numeric value, where ever they are, either as string numbers or alpha-numeric characters.
Thanks for any help.
MNRaghu
I have a list with the following words:
( "P16XYZ" "P20DGSgs" "P2GSDyh" "P1HHHye" "P11AXSss" "P45HHHhj" "P14AXCGs" "P3TYR")
(acad_strlsort (list "P16XYZ" "P20DGSgs" "P2GSDyh" "P1HHHye" "P11AXSss" "P45HHHhj" "P14AXCGs" "P3TYR"))
gives me the result as:
("P11AXSss" "P14AXCGs" "P16XYZ" "P1HHHye" "P20DGSgs" "P2GSDyh" "P3TYR" "P45HHHhj")
In the above case, though there is "P1HHHye", "P2GSDyh", "P3TYR" and "P45HHHhj", these did not appear at the start of the sorted list.
I wanted it to be this way:
("P1HHHye" "P2GSDyh" "P3TYR" "P45HHHhj" "P11AXSss" "P14AXCGs" "P16XYZ" "P20DGSgs")
The numeric values are also sorted in the same way:
Sorting of ("1" "3" "6" "22" "11" "111" "12") using acad_strlsort gives ("1" "11" "111" "12" "22" "3" "6"). I wanted it to be ("1" "3" "6" "11" "12" "22" "111").
Can any one help me to do some advanced sorting to get the ideal output that will have string numbers sorted according to their numeric value, where ever they are, either as string numbers or alpha-numeric characters.
Thanks for any help.
MNRaghu