Andyhon 发表于 2012-12-23 18:43 static/image/common/back.gif
另外一个处方:
下载 Lsort.Lsp By Tony Tanzillo
Ref: http://www.theswamp.org/index.php?topic=40302.0 ...
非常感谢!我已经把2个函数揉合了,一个就是g版的排序,另外一个论坛里搜索的正则表达式,完美解决(defun sort (l)
(vl-sort l
'(lambda (a b / a1 a2 b1 b2)
(setq a1 (zzth (car a) "")
a2 (zzth (car a) "[^0-9]")
b1 (zzth (car b) "")
b2 (zzth (car b) "[^0-9]")
)
(if (= a1 b1)
(< (atof a2) (atof b2))
(< a1 b1)
)
)
)
)
(defun zzth (str gz / regex)
(vl-load-com)
(setq regex (vlax-create-object "Vbscript.RegExp"))
(vlax-put-property regex "IgnoreCase" 0)
(vlax-put-property regex "Global" 1)
(vlax-put-property regex "Pattern" gz)
(setq str (vlax-invoke-methodregex "Replace" str ""))
)
yuanziyou 发表于 2012-12-25 14:49 static/image/common/back.gif
非常感谢!我已经把2个函数揉合了,一个就是g版的排序,另外一个论坛里搜索的正则表达式,完美解决
正则表达式,不错的解决方式。赞一个。
页:
1
[2]