literal_quotes_in_dcl_strings
Differences
This shows you the differences between two versions of the page.
literal_quotes_in_dcl_strings [2018/11/16 23:45] – initial commit lricker | literal_quotes_in_dcl_strings [2018/11/20 18:37] (current) – This article derived from "Symbol Substitution", moved text lricker | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Literal Quotes in DCL Strings ===== | ===== Literal Quotes in DCL Strings ===== | ||
- | Work-in-progress | + | What if you want to produce literal double-quote marks to be printed |
+ | |||
+ | < | ||
+ | This is " | ||
+ | </ | ||
+ | |||
+ | ...or surround some text with single quotes? -- like this: | ||
+ | < | ||
+ | This is ' | ||
+ | </ | ||
+ | |||
+ | When you want a //literal __double__-quote mark// to appear in a literal text string, you can produce it in either of these two ways: | ||
+ | < | ||
+ | $ WRITE sys$output "This is "" | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ...or: | ||
+ | < | ||
+ | $ DQUOTE = """" | ||
+ | $ WRITE sys$output "This is " + DQUOTE, " | ||
+ | $ ! This | ||
+ | $ ! | ||
+ | $ ! a single string for printing. | ||
+ | </ | ||
+ | |||
+ | ...or: | ||
+ | < | ||
+ | $ DQUOTE = """" | ||
+ | $ message = "This is " + DQUOTE, " | ||
+ | $ ! This ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
+ | $ ! | ||
+ | $ ! a single string variable for any purpose, including printing... | ||
+ | $ WRITE sys$output message | ||
+ | </ | ||
+ | |||
+ | ...or even: | ||
+ | < | ||
+ | $ DQUOTE = """" | ||
+ | $ WRITE sys$output "This is ", DQUOTE, " | ||
+ | $ ! The WRITE ^^^^^^^^^^ | ||
+ | $ ! | ||
+ | $ ! | ||
+ | </ | ||
+ | |||
+ | This suggests a similar way to produce a //literal __single__-quote mark (tick)// in text: | ||
+ | < | ||
+ | $ SQUOTE = "'" | ||
+ | $ WRITE sys$output "This is ", SQUOTE, " | ||
+ | </ | ||
+ | |||
+ | ...or: | ||
+ | < | ||
+ | $ SQUOTE = "'" | ||
+ | $ WRITE sys$output "This is " + SQUOTE + " | ||
+ | </ | ||
+ | |||
+ | ...both produce: | ||
+ | < | ||
+ | This is ' | ||
+ | </ | ||
literal_quotes_in_dcl_strings.txt · Last modified: 2018/11/20 18:37 by lricker