Single quotation mark in a text

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
zakhar
Posts: 150
Joined: 08 Sep 2010 21:13

Single quotation mark in a text

Post 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?

jupe
Posts: 2798
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Single quotation mark in a text

Post by jupe »

Wrap it in single quotes. eg.

Code: Select all

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

zakhar
Posts: 150
Joined: 08 Sep 2010 21:13

Re: Single quotation mark in a text

Post by zakhar »

Thank you, jupe!
It works!
Last edited by zakhar on 04 May 2018 01:45, edited 1 time in total.

jupe
Posts: 2798
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Single quotation mark in a text

Post 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";

zakhar
Posts: 150
Joined: 08 Sep 2010 21:13

Re: Single quotation mark in a text

Post by zakhar »

Yes, thank you, jupe, one more time!
:)

Post Reply