PDA

View Full Version : Using find and replace text in lisp


ReachAndre
2007-07-16, 07:21 PM
Hello all,
I am trying to figure out how to use find and replace text in a lisp.

example

(defun c:fnr (/ oldtxt newtxt)
(setq oldtxt (getstring T "enter text to be replaced: "))
(setq newtxt (strcat (getstring T "enter text to replace (" oldtxt "): "))
(if
("text" = oldtxt)
(replace text with newtxt)
)
(princ))

This code would obviously not work, but I hope it gives averyone an idea of what I am trying to accomplish.

Thank you all in advance for your help,
Andre

rkmcswain
2007-07-16, 07:33 PM
Take a look at this article.

http://www.dailyautocad.com/autolisp/autolisp-find-replace-application/