|
;; (abc "41+42+50*3+52+52") →("41" "42" "50" "50" "50" "52" "52")
(defun abc (str / lst a b n tmp)
(defun StrSpr (str sub / lst n)
(while (setq n (vl-string-search sub str))
(setq lst (cons (substr str 1 n) lst)
str (substr str (+ n (strlen sub) 1))
)
)
(vl-remove "" (reverse (cons str lst)))
)
(setq lst (mapcar '(lambda (x)
(if (vl-string-search "*" x)
(setq a (StrSpr x "*")
n (cadr a)
a (car a)
b (repeat (atoi n)(setq tmp (cons a tmp)))
)
(list x)
)
)
(StrSpr str "+")
)
lst (apply 'append lst)
)
) |
|