Hey Gang
Is it possible to sort the below list so that it is sequencial i.e. "ID NO. 1" "ID NO.2" .....
("ID No. 1" "ID No. 10" "ID No. 11" "ID No. 12" "ID No. 13" "ID No. 14" "ID No. 5" "ID No. 6" "ID No. 7" "ID No. 8" "ID No. 9" "ID No. 2" "ID No. 3" "ID No. 4")
tia
Southie
Found this on the search board thanks kent Cooper. I made a slight modification
(vl-sort
'("ID No. 1" "ID No. 10" "ID No. 11" "ID No. 12" "ID No. 13" "ID No. 14" "ID No. 5" "ID No. 6" "ID No. 7" "ID No. 8" "ID No. 9" "ID No. 2" "ID No. 3" "ID No. 4")
'(lambda (a b)
(<
(atoi (substr a (+ (vl-string-position (ascii " ") a 0 T) 2)))
(atoi (substr b (+ (vl-string-position (ascii " ") b 0 T) 2)))
); <
); lambda
); vl-sort
Another
(vl-sort lst '(lambda (a b / x) (setq x (vl-string-mismatch a b)) (< (atoi (substr a x))(atoi (substr b x)) ) ) )