Visual LISP, AutoLISP and General Customization
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Inch Mark in a String

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
aak194
1187 Views, 3 Replies

Inch Mark in a String

Hi all

How can we add ( " ) inch mark to a string  in autolisp

aak

3 REPLIES 3
Message 2 of 4
martti.halminen
in reply to: aak194


@aak194 wrote:

Hi all

How can we add ( " ) inch mark to a string  in autolisp

aak


Strictly speaking, you can't add anything to an existing string in AutoLISP; what you can do is create a modified copy of a string, for example by STRCAT, VL-STRING-TRANSLATE or VL-STRING-SUBST.

 

The actual problem here is probably that the ASCII 34 character is a string delimiter, so you need some tricks to make it a constituent character in a string.

 

You can either refer to it indirectly by calling a function: (chr 34), or just use in-string quotation by a backslash:

 

(strcat "23" (chr 34))

 

or

 

"23\""

 

--

 

Message 3 of 4
aak194
in reply to: martti.halminen

Hi martti

quotation by a backslash did it well.

Thanks for reply

AAK

Message 4 of 4
stevor
in reply to: aak194

Marti mentioned the strcat form, (strcat "23" (chr 34))

because that is how it is usuaslly used.

 

Example: your dimention is in a variable, like D1, and to print it:

(strcat (rtos D1 2 3) (chr 34))

 

You also could use the "\"" in the strcat.

 

S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

ā€Boost