Quotes inside wysiwyg strings, or alternative solution?
Dennis
dkorpel at gmail.com
Thu Jul 18 11:55:32 UTC 2019
On Thursday, 18 July 2019 at 11:38:55 UTC, Paul wrote:
> What is the solution in D for wysiwyg strings (or similar)
> spanning multiple lines containing quotes and apostrophes?
Take a look at:
https://dlang.org/spec/lex.html#string_literals
All string literals may span multiple lines.
If you only need " and ' without `, you can use a string literal
like this: `WysiwygCharacters`
For ' and ` in your string you can use r"WysiwygCharacters".
You can also concatenate different string literals with ~.
If your string contains code, you can try a token string like
q{if 'a' "" ``}
Finally, you can also have custom delimiters in q-strings but I
don't recommend them since they're hard to process for text
editors. (Details are in the spec)
> (also, how can I put formatted code in a post?)
Often requested, but you can't.
More information about the Digitalmars-d-learn
mailing list