刚好我前几天也写了个类似的函数,但是不知道有没有更有效率的做法,供参考吧 - (defun yd:FindNumF (txtstring / txtlen chrpointer)
- (setq txtlen (strlen txtstring))
- (setq chrpointer 0)
- (while (or (> 45 (vl-string-elt txtstring chrpointer))
- (< 58 (vl-string-elt txtstring chrpointer))
- )
- (setq chrpointer (1+ chrpointer))
- )
- (setq chrpointer (1+ chrpointer))
- (distof
- (substr txtstring chrpointer (1+ (- txtlen chrpointer)))
- 2
- )
- )
|