| Author |
Message |
mnash
Guest
|
Posted:
Tue Jan 11, 2005 8:16 pm Post subject:
filtering variable text |
|
|
In one drawing a certain variable is so many characters long say 7, and in another drawing the same type of variable is 9 characters long. How do I make the variable in both cases to get from 1234567 to 123 in the first drawing and 12345 in the second drawing. Eseentially the last four characters in the variable are useless for me. The variable I'm referring to is the filename and I want to get rid of the ".dwg" at the end.
thanks
|
|
| Back to top |
|
 |
Jason Piercey
Guest
|
Posted:
Tue Jan 11, 2005 8:29 pm Post subject:
Re: filtering variable text |
|
|
(vl-filename-base "abc.dwg")
"abc"
(vl-filename-base "abc.dwaasdasdg")
"abc"
--
Autodesk Discussion Group Facilitator
"mnash" <nospam@address.withheld> wrote in message
news:4257564.1105456649278.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | In one drawing a certain variable is so many characters long say 7, and in
another drawing the same type of variable is 9 characters long. How do I |
make the variable in both cases to get from 1234567 to 123 in the first
drawing and 12345 in the second drawing. Eseentially the last four
characters in the variable are useless for me. The variable I'm referring
to is the filename and I want to get rid of the ".dwg" at the end.
> thanks |
|
| Back to top |
|
 |
Kent Cooper, AIA
Guest
|
Posted:
Tue Jan 11, 2005 9:51 pm Post subject:
Re: filtering variable text |
|
|
Or,
(setq howlong (strlen (getvar "dwgname")))
(setq dwgnameonly (substr (getvar "dwgname") 1 (- howlong 4)))
"dwgnameonly" will be what you're looking for. The same approach will give
you back any text string with four characters removed from the end, in case
you need such a thing for anything other than the drawing name (which is the
only situation Jason's will work in).
--
Kent Cooper, AIA
"mnash" wrote...
| Quote: | In one drawing a certain variable is so many characters long say 7, and in
another drawing the same type of variable is 9 characters long. How do I
make the variable in both cases to get from 1234567 to 123 in the first
drawing and 12345 in the second drawing. Eseentially the last four
characters in the variable are useless for me. The variable I'm referring
to is the filename and I want to get rid of the ".dwg" at the end.
thanks |
|
|
| Back to top |
|
 |
|
|
|
|