text trimming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
(defun C:p074 (/ tmp ss itm obj str pos)
(vl-load-com)
(if (not #div#) (setq #div# "/"))
(setq tmp (getstring (strcat "\nDivisor character: <" #div# "> ")))
(if (= tmp "") (setq tmp #div#) (setq #div# tmp))
(setq ss (ssget "_:L" (list '(0 . "*TEXT") (cons 1 (strcat "*" #div# "*")))))
(if (and #div# SS)
(repeat (setq itm (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq itm (1- itm)))))
(setq str (vla-get-textstring obj))
(setq pos (vl-string-position (ascii #div#) str))
(vla-put-textstring obj (substr str (+ pos 2)))
);; repeat
);if
(princ)
)
I got this Lisp here.
this Lisp is trim selected texts with "/"
<selected text==>result>
textL/textR ==> textR
xxx/yyy ==>yyy
t12pty/5678 ==>5678
but I want to trim like this...
textL/textR ==> textL
xxx/yyy ==>xxx
t12pty/5678 ==>t12pty
please help... thanks friends...