Page 1 of 1

Single quotation mark in a text

Posted: 04 May 2018 01:10
by zakhar
Hello, XYplorer community!

I would like to write a text in a simple .txt-file using writefile(); .
The text contains a sequence of a letter and one concatination mark, something like this: d" .
How can I do this?

Re: Single quotation mark in a text

Posted: 04 May 2018 01:25
by jupe
Wrap it in single quotes. eg.

Code: Select all

writefile("test.txt", 'd" .');

Re: Single quotation mark in a text

Posted: 04 May 2018 01:38
by zakhar
Thank you, jupe!
It works!

Re: Single quotation mark in a text

Posted: 04 May 2018 01:45
by jupe
You didn't mention there was multiple lines, in that case the easiest way is like this

Code: Select all

   $data = <<<>>>
aaa
d".
bbb

>>>;

 writefile("<curpath>\TXT.txt", $data);

This is called a heredoc, you can paste the following into the XY address bar for more information if you are interested:

Code: Select all

::help "idh_scripting.htm#idh_scripting_heredoc";

Re: Single quotation mark in a text

Posted: 04 May 2018 01:47
by zakhar
Yes, thank you, jupe, one more time!
:)