明经CAD社区's Archiver
社区
›
AutoLISP/Visual LISP 编程技术
› [功能] 取文字前的数字
自贡黄明儒
发表于 2013-10-9 10:30:39
[功能] 取文字前的数字
;;[功能] 取文字前的数字 By 自贡黄明儒
;;http://bbs.mjtd.com/thread-107150-1-1.html中定义xd::string:regexps
;;示例(HH:StartNumber "5.4a2.32"),返回"5"
(defun HH:StartNumber (str)
(car (xd::string:regexps "^\\d+" str ""))
)
vlisp2012
发表于 2013-10-9 19:06:52
继续发好贴啊,受教了!
bzhjl
发表于 2013-10-16 01:21:05
正则!很强大
页:
[1]
查看完整版本:
[功能] 取文字前的数字