- ;;字符串转表,中英文拆分为单独文字表-----(一级)------
- ;;(sl-str->singleonly "12我 的\n三领设计#$%文字@789") ("1" "2" "我" " " "的" "\n" "三" "领" "设" "计")
- (defun sl-str->singleonly (str / strlst strlst1 hz_str num)
- (setq strlst (vl-string->list str) strlst1 '())
- (while strlst
- (setq num (car strlst))
- (cond
- ((and (not hz_str) (> num 159))
- (setq hz_str (list num))
- )
- ((and hz_str (> num 159))
- (setq hz_str (append hz_str (list num)))
- (setq strlst1 (append strlst1 (list hz_str)) hz_str nil)
- )
- ((< num 159)
- (setq hz_str nil)
- (if strlst1
- (setq strlst1 (append strlst1 (list (list num))))
- (setq strlst1 (list (list num)))
- )
- )
- )
- (setq strlst (cdr strlst))
- )
- (mapcar 'vl-list->string strlst1)
- )
- ;;字符串转表,中英文拆分为单独文字表-----(一级)------
- ;(cl-string->list "12我 的\n三领设计#$%文字@789")
- (defun cl-string->list (string / lst lst1 nn n m)
- (setq nn (strlen string) n 0 m 1)
- (repeat nn
- (setq n (1+ n) lst (vl-string->list (substr string n m)))
- (if (vl-remove-if '(lambda (x) (< x 128)) lst)
- (progn
- (if (= (length lst) 2)
- (progn
- (setq lst1 (cons (vl-list->string lst) lst1))
- (if (= m 2) (setq n (1+ n) m 1))
- )
- (setq n (1- n) m 2)
- )
- )
- (setq lst1 (cons (vl-list->string lst) lst1))
- )
- )
- (reverse lst1)
- )
- ;;字符串转表,中英文拆分为单独文字表-----(一级)------
- ;(_Str2List "12我 的\n三领设计#$%文字@789")
- (defun _Str2List (str / a);作者:LLSheng_73
- (setq str (vl-string->list str))
- (while
- (if (< (car str) 129)
- (setq a (cons (chr (car str)) a) str (cdr str))
- (setq a (cons (strcat (chr (car str)) (chr (cadr str))) a) str (cddr str))
- )
- )
- (reverse a)
- )
|