也许OP只是想分配变量?即:ND1500,值返回“11800”
不管任何情况。
- (defun [color="blue"]assign_val[/color] (str / i $ l )
- (while (setq i (vl-string-search "," str))
- (setq l (cons (substr str 1 i) l)
- str (substr str (+ 2 i) (- (strlen str) i))
- ) ;_ end of setq
- ) ;_ end of while
- (setq l (reverse (vl-remove "" (cons str l))))
- (setq $ (nth 2 l) i (read $ ))
- (if (and (numberp i) (zerop (rem i 50)) (<= 25 i 2000))
- (set (read (strcat (nth 1 l) $)) (nth 3 l))
- ) ;_ end of if
- ) ;_ end of defun
这就是为什么知道和理解来源是重要的。
对于这个特定的字符串语法,从(读取行…)价值
UET,ND,MI,150026201460,,,
,,,,,,,,
45Y,ND,MI,150250400400,,
45Y,ND,MI,200330540540,,
,,,,,,,,
,,,,,,,,
NWP,ND,-,300,50440,,,
[code](defun _string2List(str)(if(setq lst(read(strcat)(“(vl string translate)”,“str)”))))(mapcar’(lambda(x)(if(numberp x)(itoa x); |