HARRY-PLOTTER Posted December 4, 2013 Share Posted December 4, 2013 How can i insert " symbol in a string? I need a string like 3/16"...and i want to do something like (strcat "3/16" """)- how to do this? Thanks! Quote Link to comment Share on other sites More sharing options...
MSasu Posted December 4, 2013 Share Posted December 4, 2013 Just precede the symbol with a backslash: (setq dist "3/16[color=magenta]\[/color]"") Quote Link to comment Share on other sites More sharing options...
HARRY-PLOTTER Posted December 4, 2013 Author Share Posted December 4, 2013 this is what i want to do : (command "_.-scalelistedit" "d" "1/32" = 1'-0"") - how? Quote Link to comment Share on other sites More sharing options...
MSasu Posted December 4, 2013 Share Posted December 4, 2013 Like this? (command "_.-scalelistedit" "[color=red]_[/color]D" "1/32[color=red]\[/color]" = 1'-0[color=red]\[/color]""[color=red] "_E"[/color]) A good programming practice is to use "_" in front of both commands and their options to ensure that your code works on localized AutoCAD; you need also to exit that command call. By the way, please edit your previous post to add the required code tags. Quote Link to comment Share on other sites More sharing options...
dbroada Posted December 4, 2013 Share Posted December 4, 2013 I didn't know about the backslash. In VB/VBA I have used chr$(34) (or similar) and was about to ask if backslash works there before I realised I can check for myself - another day. Quote Link to comment Share on other sites More sharing options...
MSasu Posted December 4, 2013 Share Posted December 4, 2013 If one want to go with the character approach: (strcat "3/16" (chr 34)) Dbroada , regarding Visual Basic 6, the backslash solution will not work; use this instead: "3/16""" Quote Link to comment Share on other sites More sharing options...
dbroada Posted December 4, 2013 Share Posted December 4, 2013 ok, thanks Mircea. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 4, 2013 Share Posted December 4, 2013 (edited) Here is some information I have posted in the past about the backslash character: Since the quotation mark (") is the delimiter in AutoLISP to denote a string literal, the backslash escape character must be used to mark quotation characters within the string as literal quotes, not to be interpreted as string delimiters. Similarly, since the backslash is an escape character, backslash characters present in the string must be prefixed with a backslash to mark them as literal characters, not to be interpreted as escape characters. Read the following articles to understand more: String Literal Escape Character Delimiter Collision Leaning Toothpick Syndrome (I particularly like that last one!) For an easy way to determine where the backslash character is required you can use the following simple program: (defun c:literal ( ) (getstring t "\nEnter string: ")) Hence, for your example: Command: literal Enter string: 1/32" = 1'-0" "1/32\" = 1'-0\"" Edited June 12, 2019 by Lee Mac Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.