本帖最后由 xyp1964 于 2017-11-20 21:58 编辑
- ;; xyp-Str2List 将一行字符串拆分转为单独字符表 (xyp-Str2List str)
- ;; (xyp-Str2List "123工具箱函数再揭秘及应用实例Abc") → ("1" "2" "3" "工" "具" "箱" "函" "数" "再" "揭" "秘" "及" "应" "用" "实" "例" "A" "b" "c")
- (defun xyp-Str2List (str / i lst tx)
- (setq i 1 lst '())
- (while (<= i (strlen str))
- (setq tx (substr str i 1))
- (if (> (ascii tx) 126)
- (setq tx (substr str i 2)
- i (+ i 2)
- lst (cons tx lst)
- )
- (setq i (1+ i)
- lst (cons tx lst)
- )
- )
- )
- (reverse lst)
- )
|