明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1616|回复: 4

请高手相助!选择含分号的字符串,将分号“;”前后的文字互换

[复制链接]
发表于 2013-6-25 16:40:51 | 显示全部楼层 |阅读模式
10明经币
本帖最后由 xuzhigangrene 于 2013-6-26 17:23 编辑

如题!
如:B4f22;T3f20变成T3f20;B4f22
附件: 您需要 登录 才可以下载或查看,没有账号?注册
发表于 2013-6-25 16:40:52 | 显示全部楼层
  1. (defun AYL-ssClist (ss / EnLst n)
  2.   (setq EnLst nil)
  3.   (repeat (setq n (sslength ss))
  4.     (setq EnLst (cons (ssname ss (setq n (1- n))) EnLst))
  5.   )
  6. )
  7. (defun AYL-UMString (String Sustr / StrLst n Sustr0)
  8.   (setq StrLst nil)
  9.   (while (setq n (vl-string-search Sustr String))
  10.     (setq Sustr0 (substr String 1 n)
  11.           String (substr String (+ n (strlen Sustr) 1))
  12.           StrLst (cons Sustr (cons Sustr0 StrLst))
  13.     )
  14.   )
  15.   (apply 'strcat (cons String StrLst))
  16. )
  17. (defun c:tt (/ EntLst)
  18.   (if (setq ss (ssget '((0 . "*Text"))))
  19.     (progn
  20.       (setq EntLst (AYL-ssClist ss)
  21.             ss           nil
  22.       )
  23.       (mapcar
  24.         (function
  25.           (lambda (x / a b)
  26.             (setq a (entget x)
  27.                   b (assoc 1 a)
  28.             )
  29.             (entmod (subst (cons 1 (AYL-UMString (cdr b) ";")) b a))
  30.           )
  31.         )
  32.         EntLst
  33.       )
  34.     )
  35.   )
  36.   (princ)
  37. )
回复

使用道具 举报

 楼主| 发表于 2013-6-26 10:05:33 | 显示全部楼层
这个插件不好弄吗?各位大神帮帮忙吧~
回复

使用道具 举报

 楼主| 发表于 2013-6-27 09:39:50 | 显示全部楼层
nzl1116 发表于 2013-6-26 19:20

很好用,满足了我的要求
回复

使用道具 举报

发表于 2013-6-27 17:23:08 | 显示全部楼层
nzl1116 发表于 2013-6-25 16:40

感謝 nzl1116 分享程序!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-2-27 14:23 , Processed in 0.168172 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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