本帖最后由 秋枫 于 2021-8-19 12:08 编辑

- (defun strsplit (str pat / i j n lst)
- (cond
- ((/= (type str) (type pat) 'STR))
- ((= str pat) '(""))
- (T
- (setq i 0
- n (strlen pat)
- )
- (while (setq j (vl-string-search pat str i))
- (setq lst (cons (substr str (1+ i) (- j i)) lst)
- i (+ j n)
- )
- )
- (reverse (cons (substr str (1+ i)) lst))
- )
- )
- )
- (defun strjoin (Lst Delimiter / return)
- (setq return "")
- (foreach str Lst
- (setq return (strcat return Delimiter str))
- )
- (substr return 2)
- )
@尘缘一生
|