(setq lst '("PS_2_PW" "DIE_1_PW" "PS_PW" "PH_PW" "DIE_PW" "PH_1_PW" "DIE_2_PW" "PS_1_PW"))
(setq ls ...
如果排序的表中没有规则表中的关键字,排序后会丢掉的怎么处理?如下表中的“DDD-”
(setq lst '("PS_2_PW" "DIE_1_PW" "PS_PW" "PH_PW" "DIE_PW" "PH_1_PW" "DIE_2_PW" "PS_1_PW" "DDD-1" "DDD-2"))
(setq lst< '("DIE" "PS" "PH")) (setq lst '("PS_2_PW" "DDD-1" "DIE_1_PW" "PS_PW"
"PH_PW" "DIE_PW" "PH_1_PW" "DIE_2_PW"
"DDD-34" "PS_1_PW"
)
)
(setq lst< '("DIE" "PS" "PH"))
(foreach abc lst
(or (vl-position
t
(mapcar
'(lambda (x) (wcmatch abc (strcat x "*")))
lst<
)
)
(setq lst2 (cons abc lst2))
)
)
(append
(apply
'append
(mapcar
'(lambda (a / l)
(if (setq l (vl-remove-if-not
'(lambda (b) (wcmatch b (strcat a "*")))
lst
)
)
(vl-sort l
'(lambda (c d / an)
(setq an (+ (strlen a) 2))
(< (atoi (substr c an 1)) (atoi (substr d an 1)))
)
)
)
)
lst<
)
)
(reverse lst2)
)
kozmosovia 发表于 2024-11-20 20:12
:handshake
页:
1
[2]