想写一个判定字符串B的第几位为数字的程序
(defun c:pd(/ b)
(setq b "AsdddsBCD51qw1")
(setq a(pan b))
(print a)
)
;;----------------------第几位为数字
(defun pan(f_1 / long bi time cap asc )
(setq long(strlen f_1));long字符串长度
(setq bi 0) ;bi为数字位数
(setq time 1) ;time为循环标志
(while(<= time long)
(setq cap(substr f_1 time 1)) ;cap为该位字符
(setq asc(ascii cap)) ;asc为字符的ASC码
(if(and(< asc 58)(> asc 47)) (setq bi time time long) )
(setq time(+ time 1))
)
(setq bi bi)
)
返回值正确