User Tools

Site Tools


literal_quotes_in_dcl_strings

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

literal_quotes_in_dcl_strings [2018/11/16 23:45] – initial commit lrickerliteral_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 in a string of text? -- like this: 
 + 
 +<code> 
 +This is "double-quoted-text"
 +</code> 
 + 
 +...or surround some text with single quotes? -- like this: 
 +<code> 
 +This is 'singled-quoted-text'
 +</code> 
 + 
 +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: 
 +<code> 
 +$ WRITE sys$output "This is ""double-quoted-text""." 
 +                          ^^                  ^^ |   ! Use two double-quotes where you want one printed, 
 +                                                   ! and these two double-quotes delimit the literal string. 
 +</code> 
 + 
 +...or: 
 +<code> 
 +$ DQUOTE = """"   ! Create a variable whose content/value is a single double-quote mark! 
 +$ WRITE sys$output "This is " + DQUOTE, "double-quoted-text" + DQUOTE + "." 
 +$ ! This           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 +$ !   concatenates several substrings (including the value of DQUOTE) into 
 +$ !   a single string for printing. 
 +</code> 
 + 
 +...or: 
 +<code> 
 +$ DQUOTE = """"   ! Create a variable whose content/value is a single double-quote mark! 
 +$ message = "This is " + DQUOTE, "double-quoted-text" + DQUOTE + "." 
 +$ ! This    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 +$ !   concatenates several substrings (including the value of DQUOTE) into 
 +$ !   a single string variable for any purpose, including printing... 
 +$ WRITE sys$output message 
 +</code> 
 + 
 +...or even: 
 +<code> 
 +$ DQUOTE = """"   ! Create a variable whose value is a single double-quote mark! 
 +$ WRITE sys$output "This is ", DQUOTE, "double-quoted-text", DQUOTE, "." 
 +$ ! The WRITE      ^^^^^^^^^^  ^^^^^^  ^^^^^^^^^^^^^^^^^^^^  ^^^^^^  ^^^ 
 +$ !   command takes several expressions (here, just literal strings) and 
 +$ !   concatenates them itself for printing. 
 +</code> 
 + 
 +This suggests a similar way to produce a //literal __single__-quote mark (tick)// in text: 
 +<code> 
 +$ SQUOTE = "'"   ! Create a variable whose value is a single single-quote mark! 
 +$ WRITE sys$output "This is ", SQUOTE, "singe-quoted-text", SQUOTE, "." 
 +</code> 
 + 
 +...or: 
 +<code> 
 +$ SQUOTE = "'"   ! Create a variable whose value is a single single-quote mark! 
 +$ WRITE sys$output "This is " + SQUOTE + "singe-quoted-text" + SQUOTE + "." 
 +</code> 
 + 
 +...both produce: 
 +<code> 
 +This is 'single-quoted-text'
 +</code> 
  
literal_quotes_in_dcl_strings.txt · Last modified: 2018/11/20 18:37 by lricker

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki