Combining techniques from both functions and optimising Irneb's string separation loop:
(defun _FileSort2 ( lst ignorecase / comparable )
(defun comparable ( e1 e2 )
(or
(and (numberp e1) (numberp e2))
(= 'STR (type e1) (type e2))
)
)
(mapcar '(lambda ( x ) (nth x lst))
(vl-sort-i
(mapcar
(function
(lambda ( str / lst rslt tmp )
(setq lst (vl-string->list (if ignorecase (strcase str) str)))
(while lst
(if (= 46 (car lst))
(setq lst nil)
)
(while (< 47 (car lst) 58)
(setq tmp (cons (car lst) tmp)
lst (cdr lst)
)
)
(if tmp
(setq rslt (cons (atoi (vl-list->string (reverse tmp))) rslt)
tmp nil
)
)
(while (and lst (not (< 45 (car lst) 58)))
(setq tmp (cons (car lst) tmp)
lst (cdr lst)
)
)
(if tmp
(setq rslt (cons (vl-list->string (reverse tmp)) rslt)
tmp nil
)
)
)
(reverse rslt)
)
)
lst
)
(function
(lambda ( x1 x2 / n1 n2 comp )
(while
(and
(setq comp (comparable (setq n1 (car x1)) (setq n2 (car x2))))
(= n1 n2)
(setq x1 (cdr x1))
(setq x2 (cdr x2))
)
)
(cond
((null x1))
(comp (< n1 n2))
((numberp n1))
)
)
)
)
)
)
Verification:
_$ (equal (_FileSort FilesList@ t) (_FileSort2 FilesList@ t))
T
Result:
Benchmarking ..............Elapsed milliseconds / relative speed for 2048 iteration(s):
(_FILESORT2 FILESLIST@ T)....................1904 / 2.1 <fastest>
(_FILESORT FILESLIST@ T).....................2418 / 1.65
(SORTSTRINGWITHNUMBERASNUMBER3 FILES...).....2932 / 1.36
(SORTSTRINGWITHNUMBERASNUMBER FILESL...).....3994 / 1 <slowest>