02-07-2009, 03:03 PM
This is not perfect and little tested.
Macro
Function sort_proc_str_logical
Function StrCompareLogical
Function SCL_RxProc
Macro
out
str s=
;ab1234/3:10
;ab1234/3:9
;bc3234/2:3
;ch8218/5:2
;ab1234/3:1
;bc3234/2:2
ARRAY(str) a=s
;a.shuffle
a.sort(0 sort_proc_str_logical 0)
out aFunction sort_proc_str_logical
function# param str&a str&b
ret StrCompareLogical(a b)
;dll- shlwapi #StrCmpLogicalW @*psz1 @*psz2
;
;if(_winver>=0x501) ;;XP
,;BSTR w1(a) w2(b)
,;ret StrCmpLogicalW(w1 w2)
;else
,;;ret StrCompare(a b 1)
,;ret StrCompareLogical(a b)Function StrCompareLogical
;/
function# $s1 $s2
lpstr sn="0123456789"
if(findcs(s1 sn)<0 or findcs(s2 sn)<0) ret StrCompare(s1 s2 1)
str ss1(s1) ss2(s2)
REPLACERX r.frepl=&SCL_RxProc
ss1.replacerx("\d+" r)
ss2.replacerx("\d+" r)
;out ss1
ret StrCompare(ss1 ss2 1)Function SCL_RxProc
