Johntosh 发表于 2022-7-6 17:05:10

write-line to include quote ma

How does one write double quotes to a file?
 
for example:
 
(write-line "alpha beta alpha beta "delta" alpha beta alpha beta")
 
N.B. delta should have double quote marks, I need it all on one line so this discounts write-char (I think)?
 
Thanks for any help on this

borgunit 发表于 2022-7-6 17:17:52

You can concatenate the string using chr(34) wherever you need a quotation. VB recognizes that as the quotation mark.
 
LINK:
http://www.vbforfree.com/?p=312

David Bethel 发表于 2022-7-6 17:39:16

Check out the 'Control Character in Quoted Strings' topic in the Vlisp help.It is actually a good one.
 
At least that's how it is listed in A2K help.-David

jammie 发表于 2022-7-6 17:43:59

Following on the above replies, prefix a quote with a backslash to output it as a literal string
 
 
\"delta\" will output as "delta"
 
(write-line "alpha beta alpha beta\"delta \" alpha beta alpha beta")
 
Regards,
 
Jammie

Lee Mac 发表于 2022-7-6 18:00:14

As in Jammie's example above - the \ (backslash) character prefix will allow the subsequent character to be read as a string instead of a syntax.
 
i.e.
 
\\=\
\"="
\n=new line
\t=tab
 
etc
 
And so, if you want to specify for example a filepath, one must include the double backslash to indicate a single:
 
C:\\Users\\Lee Mac\\Documents....

BIGAL 发表于 2022-7-6 18:11:31

This may also be a way around another problem of spaces in directory names the path stops at a space using lisp, had to resort to VBA to get around it.
 
C:\\Users\\Lee Mac\\Documents....
or
C:\\Users\\Lee\ Mac\\Documents....
页: [1]
查看完整版本: write-line to include quote ma