TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Dommy2Hotty on October 28, 2004, 12:47:00 PM
-
Here's my code...what would I need to add/change to REPLACE the \\ with \ from the returned path?
(defun c:DWGNAME (/ path name)
(setq path (getvar "dwgprefix"))
(setq name (getvar "dwgname"))
(setq name (strcat path name))
(setq name (substr name 1 (- (strlen name) 4)))
(print name)
(princ)
)
-
I can't think of why you would want to do such a thing but vl-string-subst will allow you to substitute one string for another, e.g. "" for "\\". Also, you might want to consider using vl-filename-base to strip extensions.
Cheers. :)
-
I can't think of why you would want to do such a thing but vl-string-subst will allow you to substitute one string for another, e.g. "" for "\\". Also, you might want to consider using vl-filename-base to strip extensions.
Cheers. :)
OOPS :oops: Edited the title and my first post...not take out, replace \\ with \
My bad!
-
Edited the title and my first post...not take out, replace \\ with \ ...
Ummm, you don't really want to do this (you can't anyway). Please read the "Control Characters in Strings" section in the Visual LISP Developer's Guide. :)
-
Ditto MP
-
I'm not sure what you are trying to achieve, but have you tried
(fnsplitl (getvar "dwgname"))