QUAN2518 发表于 2011-10-23 10:56:02

如何用制定的字符对字符串分段提取字符,

本帖最后由 QUAN2518 于 2011-10-23 10:57 编辑

如何用制定的字符对字符串分段提取字符,
A字符串为: 今天;上午;过后      
提取出3个字符串:“今天” “上午” “过后”

B字符串为:   大后天;中午10点;无记录   
提取出3个字符串:“大后天” “中午10点” “无记录”

如何使用LISP代码 对上2个字符串提取出后面的结果.
要识别的字符串中间有一个识别符号 “;”


飞诗(fsxm) 发表于 2011-10-23 11:06:24


(defun Fsxm-Split (string strkey / po strlst xlen)
(setq xlen (1+ (strlen strkey)))
(while (setq po (vl-string-search strkey string))
    (setq strlst (cons (substr string 1 po) strlst))
    (setq string (substr string (+ po xlen)))
)
(reverse (cons string strlst))
)

1548845899 发表于 2011-10-23 11:25:49

cabinsummer 发表于 2011-10-23 12:46:39

参见http://bbs.mjtd.com/forum.php?mod=viewthread&tid=89886&page=1#pid486747

QUAN2518 发表于 2011-10-23 15:07:37

检测通过
谢谢

飞诗(fsxm) 发表于 2011-10-23 15:55:53

来点实际的,送一个明经币哈!
没看公告吗?免费送币都不送

bzhjl 发表于 2014-1-7 19:34:16

谢谢斑竹!
页: [1]
查看完整版本: 如何用制定的字符对字符串分段提取字符,