Maybe, just simply :

Code:

(defun _sort-1 ( l / asciivalue )
(defun asciivalue ( str / s sl sv )
(while (/= "" (setq s (substr str 1 1)))
(setq sl (cons s sl))
(setq str (substr str 2))
)
(setq sl (reverse sl))
(setq sv (apply 'strcat (mapcar '(lambda ( x ) (itoa (+ 100 (ascii x)))) sl)))
sv
)
(vl-sort l '(lambda ( a b ) (< (asciivalue a) (asciivalue b))))
)
(defun _sort-2 ( l / groupbystrlen )
(defun groupbystrlen ( l / nmax k g gg )
(setq nmax (strlen (car (vl-sort l '(lambda ( a b ) (> (strlen a) (strlen b)))))))
(setq k 0)
(repeat nmax
(setq k (1+ k))
(setq g (vl-remove-if-not '(lambda ( x ) (= (strlen x) k)) l))
(setq gg (cons g gg))
)
(reverse gg)
)
(apply 'append (mapcar '(lambda ( x ) (acad_strlsort x)) (groupbystrlen l)))
)
(defun _sort-3 ( l / groupbystrlen )
(defun groupbystrlen ( l / nmax k g gg )
(setq nmax (strlen (car (vl-sort l '(lambda ( a b ) (> (strlen a) (strlen b)))))))
(setq k 0)
(repeat nmax
(setq k (1+ k))
(setq g (vl-remove-if-not '(lambda ( x ) (= (strlen x) k)) l))
(setq gg (cons g gg))
)
(reverse gg)
)
(apply 'append (mapcar '(lambda ( x ) (vl-sort x '<)) (groupbystrlen l)))
)
(defun _sort-4 ( l / groupbystrlen asciivalue gg nmax q gav gsav ggsav )
(defun groupbystrlen ( l / nmax k g gg )
(setq nmax (strlen (car (vl-sort l '(lambda ( a b ) (> (strlen a) (strlen b)))))))
(setq k 0)
(repeat nmax
(setq k (1+ k))
(setq g (vl-remove-if-not '(lambda ( x ) (= (strlen x) k)) l))
(setq gg (cons g gg))
)
(reverse gg)
)
(defun asciivalue ( str / s sl sv )
(while (/= "" (setq s (substr str 1 1)))
(setq sl (cons s sl))
(setq str (substr str 2))
)
(setq sl (reverse sl))
(setq sv (apply 'strcat (mapcar '(lambda ( x ) (itoa (+ 100 (ascii x)))) sl)))
sv
)
(setq gg (groupbystrlen l))
(setq nmax (strlen (car (last gg))))
(foreach g gg
(setq q "")
(repeat (- nmax (strlen (car g)))
(setq q (strcat "099" q))
)
(setq gav (mapcar '(lambda ( x ) (strcat (asciivalue x) q)) g))
(setq gsav (mapcar '(lambda ( a b ) (list a b)) g gav))
(setq ggsav (cons gsav ggsav))
)
(setq ggsav (apply 'append (reverse ggsav)))
(mapcar 'car (vl-sort ggsav '(lambda ( a b ) (< (cadr a) (cadr b)))))
)
;; Alphanumerical Sort - Lee Mac
;; Sorts a list of strings containing a combination of alphabetical & numerical characters.
(defun LM:AlphanumSort ( l )
(mapcar (function (lambda ( n ) (nth n l)))
(vl-sort-i (mapcar 'LM:SplitString l)
(function
(lambda ( a b )
( (lambda ( f ) (f a b))
(lambda ( a b / x y )
(setq x (car a) y (car b))
(cond
( (null x) b)
( (null y) nil)
( (= x y) (f (cdr a) (cdr b)))
( (and (numberp x) (numberp y)) (< x y))
( (numberp x))
( (numberp y) nil)
( (< x y))
)
)
)
)
)
)
)
)
;; Split String - Lee Mac
;; Splits a string into a list of text and numbers
(defun LM:SplitString ( s )
(
(lambda ( l )
(read
(strcat "("
(vl-list->string
(apply 'append
(mapcar
(function
(lambda ( a b c )
(if (or (< 47 b 58)
(and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
(and (= 46 b) (< 47 a 58) (< 47 c 58))
)
(list b)
(list 32 34 b 34 32)
)
)
)
(cons nil l) l (append (cdr l) '(( )))
)
)
)
")"
)
)
)
(vl-string->list s)
)
)
;|
(setq l (list "0" "01" "010" "020" "0a0" "0A0" "0c0" "0C0" "0a1" "0c1" "012" "01a" "02a" "1" "11" "110" "120" "1a0" "1A0" "1c0" "1C0" "1a1" "1c1" "112" "11a" "12a" "a" "a1" "a10" "a20" "aa0" "aA0" "ac0" "aC0" "aa1" "ac1" "a12" "a1a" "a2a" "c" "c1" "c10" "c20" "ca0" "cA0" "cc0" "cC0" "ca1" "cc1" "c12" "c1a" "c2a" "A" "A1" "A10" "A20" "Aa0" "AA0" "Ac0" "AC0" "Aa1" "Ac1" "A12" "A1a" "A2a" "C" "C1" "C10" "C20" "Ca0" "CA0" "Cc0" "CC0" "Ca1" "Cc1" "C12" "C1a" "C2a"))
(_sort-1 l) => ("0" "1" "A" "C" "a" "c" "01" "11" "A1" "C1" "a1" "c1" "010" "012" "01a" "020" "02a" "0A0" "0C0" "0a0" "0a1" "0c0" "0c1" "110" "112" "11a" "120" "12a" "1A0" "1C0" "1a0" "1a1" "1c0" "1c1" "A10" "A12" "A1a" "A20" "A2a" "AA0" "AC0" "Aa0" "Aa1" "Ac0" "Ac1" "C10" "C12" "C1a" "C20" "C2a" "CA0" "CC0" "Ca0" "Ca1" "Cc0" "Cc1" "a10" "a12" "a1a" "a20" "a2a" "aA0" "aC0" "aa0" "aa1" "ac0" "ac1" "c10" "c12" "c1a" "c20" "c2a" "cA0" "cC0" "ca0" "ca1" "cc0" "cc1")
(_sort-2 l) => ("0" "1" "a" "A" "c" "C" "01" "11" "a1" "A1" "c1" "C1" "010" "012" "01a" "020" "02a" "0a0" "0A0" "0a1" "0c0" "0C0" "0c1" "110" "112" "11a" "120" "12a" "1a0" "1A0" "1a1" "1c0" "1C0" "1c1" "a10" "A10" "a12" "A12" "a1a" "A1a" "a20" "A20" "a2a" "A2a" "aa0" "aA0" "Aa0" "AA0" "aa1" "Aa1" "ac0" "aC0" "Ac0" "AC0" "ac1" "Ac1" "c10" "C10" "c12" "C12" "c1a" "C1a" "c20" "C20" "c2a" "C2a" "ca0" "cA0" "Ca0" "CA0" "ca1" "Ca1" "cc0" "cC0" "Cc0" "CC0" "cc1" "Cc1")
(_sort-3 l) => ("0" "1" "A" "C" "a" "c" "01" "11" "A1" "C1" "a1" "c1" "010" "012" "01a" "020" "02a" "0A0" "0C0" "0a0" "0a1" "0c0" "0c1" "110" "112" "11a" "120" "12a" "1A0" "1C0" "1a0" "1a1" "1c0" "1c1" "A10" "A12" "A1a" "A20" "A2a" "AA0" "AC0" "Aa0" "Aa1" "Ac0" "Ac1" "C10" "C12" "C1a" "C20" "C2a" "CA0" "CC0" "Ca0" "Ca1" "Cc0" "Cc1" "a10" "a12" "a1a" "a20" "a2a" "aA0" "aC0" "aa0" "aa1" "ac0" "ac1" "c10" "c12" "c1a" "c20" "c2a" "cA0" "cC0" "ca0" "ca1" "cc0" "cc1")
(_sort-1 l) = (_sort-3 l) => (vl-sort l '<) is sorting according to ascii values
(_sort-4 l) => ("0" "01" "010" "012" "01a" "020" "02a" "0A0" "0C0" "0a0" "0a1" "0c0" "0c1" "1" "11" "110" "112" "11a" "120" "12a" "1A0" "1C0" "1a0" "1a1" "1c0" "1c1" "A" "A1" "A10" "A12" "A1a" "A20" "A2a" "AA0" "AC0" "Aa0" "Aa1" "Ac0" "Ac1" "C" "C1" "C10" "C12" "C1a" "C20" "C2a" "CA0" "CC0" "Ca0" "Ca1" "Cc0" "Cc1" "a" "a1" "a10" "a12" "a1a" "a20" "a2a" "aA0" "aC0" "aa0" "aa1" "ac0" "ac1" "c" "c1" "c10" "c12" "c1a" "c20" "c2a" "cA0" "cC0" "ca0" "ca1" "cc0" "cc1")
(LM:AlphanumSort l) => ("0" "0A0" "0C0" "0a0" "0a1" "0c0" "0c1" "1" "01" "1A0" "1C0" "01a" "1a0" "1a1" "1c0" "1c1" "02a" "010" "11" "11a" "012" "12a" "020" "110" "112" "120" "A" "A1" "A1a" "A2a" "A10" "A12" "A20" "AA0" "AC0" "Aa0" "Aa1" "Ac0" "Ac1" "C" "C1" "C1a" "C2a" "C10" "C12" "C20" "CA0" "CC0" "Ca0" "Ca1" "Cc0" "Cc1" "a" "a1" "a1a" "a2a" "a10" "a12" "a20" "aA0" "aC0" "aa0" "aa1" "ac0" "ac1" "c" "c1" "c1a" "c2a" "c10" "c12" "c20" "cA0" "cC0" "ca0" "ca1" "cc0" "cc1")
(acad_strlsort l) => ("0" "01" "010" "012" "01a" "020" "02a" "0a0" "0A0" "0a1" "0c0" "0C0" "0c1" "1" "11" "110" "112" "11a" "120" "12a" "1a0" "1A0" "1a1" "1c0" "1C0" "1c1" "a" "A" "a1" "A1" "a10" "A10" "a12" "A12" "a1a" "A1a" "a20" "A20" "a2a" "A2a" "aa0" "aA0" "Aa0" "AA0" "aa1" "Aa1" "ac0" "aC0" "Ac0" "AC0" "ac1" "Ac1" "c" "C" "c1" "C1" "c10" "C10" "c12" "C12" "c1a" "C1a" "c20" "C20" "c2a" "C2a" "ca0" "cA0" "Ca0" "CA0" "ca1" "Ca1" "cc0" "cC0" "Cc0" "CC0" "cc1" "Cc1")
(vl-sort l '<) => ("0" "01" "010" "012" "01a" "020" "02a" "0A0" "0C0" "0a0" "0a1" "0c0" "0c1" "1" "11" "110" "112" "11a" "120" "12a" "1A0" "1C0" "1a0" "1a1" "1c0" "1c1" "A" "A1" "A10" "A12" "A1a" "A20" "A2a" "AA0" "AC0" "Aa0" "Aa1" "Ac0" "Ac1" "C" "C1" "C10" "C12" "C1a" "C20" "C2a" "CA0" "CC0" "Ca0" "Ca1" "Cc0" "Cc1" "a" "a1" "a10" "a12" "a1a" "a20" "a2a" "aA0" "aC0" "aa0" "aa1" "ac0" "ac1" "c" "c1" "c10" "c12" "c1a" "c20" "c2a" "cA0" "cC0" "ca0" "ca1" "cc0" "cc1")
(_sort-4 l) = (vl-sort l '<) => (vl-sort l '<) is sorting according to ascii values
|;

M.R.