找回密码
 [加入论坛]
查看: 1368|回复: 2

替换字符串中的单个字符

[复制链接]
2443725 发表于 2005-2-28 23:19 | 显示全部楼层 |阅读模式
<><FONT face=宋体>(defun replstr (old new str)
  (setq nstr "")
  (repeat (strlen str)
    (if        (= (substr str 1 1) old)
      (setq nstr (strcat nstr new))
      (setq nstr (strcat nstr (substr str 1 1)))
    )
    (setq str (substr str 2))
  )
  nstr
)</FONT></P>
<P><FONT face=宋体></FONT> </P>
<P>你使用R14的话就不好用下面的了</P>
<P><FONT face=宋体>(defun ea:repstr (new old str)
  (vl-list-&gt;string
    (subst (ascii new) (ascii old) (vl-string-&gt;list str))
  )
)</FONT></P>
nich999 发表于 2005-3-2 03:07 | 显示全部楼层
好好
回复 顶 踩

使用道具 举报

nich999 发表于 2005-3-2 03:07 | 显示全部楼层
谢谢
回复 顶 踩

使用道具 举报

您需要登录后才可以回帖 登录 | [加入论坛]

本版积分规则

手机版|化工技术网- 赠人玫瑰 手有余香 ( 苏ICP备14035884号 )

GMT+8, 2026-12-1 16:39

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表