拆分字符串
<p>各位高手能不能设计一个LISP程序拆分字符串,</p><p>比如CAD里有个字符串是“0.3-0.8”,运行设计的LISP后,选择这个字符串,会拆分为“0.3”,“0.8”两个。谢谢了</p><p>还有比如“0.3-0.8-1.2”三组的能不能也拆分为“0.3”,“0.8”,“1.2”</p> <p>使用以下语句,得到b b1 b2即为所需要的值: </p><p> (setq a2 "0.3-0.8-1.2")</p><p> (setq a3 (vl-string-position (ascii "-") a2))<br/> (setq a4 (vl-string-position (ascii "-") a2 (+ a3 1)))<br/> (setq b (substr a2 1 a3))<br/> <br/> (setq b1 (substr a2 (+ a3 2) (- a4 a3 1)) )<br/> (setq b2 (substr a2 (+ a4 2)) )</p><p></p> 楼主有没有研究出来?
页:
[1]