吉尔先生很好,把这些贴了一次。。。
- ;;; STR2LST
- ;;; Transforms a string with separator into a list of strings
- ;;; Author: Gile
- ;;; Arguments
- ;;; str = the string
- ;;; sep = the separator pattern
- (defun str2lst (str sep / pos)
- (if (setq pos (vl-string-search sep str))
- (cons (substr str 1 pos)
- (str2lst (substr str (+ (strlen sep) pos 1)) sep)
- )
- (list str)
- )
- )
- ;;; lST2STR
- ;;; Returns a string which is the concatenation of a list and a separator
- ;;; Author: Gile
- ;;; Arguments
- ;;; str = the string
- ;;; sep = the separator pattern
- (defun lst2str (lst sep)
- (if (cadr lst)
- (strcat (vl-princ-to-string (car lst))
- sep
- (lst2str (cdr lst) sep)
- )
- (vl-princ-to-string (car lst))
- )
- )
|