User Tools

Site Tools


symbol_substitution

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
symbol_substitution [2018/11/20 16:22]
lricker clarifications
symbol_substitution [2018/11/20 18:36]
lricker move "Literal Quotes in DCL Strings" to separate wiki article
Line 105: Line 105:
 ==== Producing Quotes in Quotes ==== ==== Producing Quotes in Quotes ====
  
-What if you want to produce literal double-quote marks to be printed in a string of text? -- like:+What if you want to produce literal double-quote marks to be printed in a string of text? -- like this:
  
 <​code>​ <​code>​
Line 111: Line 111:
 </​code>​ </​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:+...or surround some text with single quotes? -- like this:
 <​code>​ <​code>​
-$ WRITE sys$output "This is ""​double-quoted-text""​."​ +This is '​singled-quoted-text'.
-                   ​| ​       ^^                  ^^ |   ! Use two double-quotes where you want one printed, +
-                   ​^ ​                              ​^ ​  ! and these two double-quotes delimit the literal string.+
 </​code>​ </​code>​
  
-...or: +These are pretty common use-cases -- See the wiki article [[Literal Quotes in DCL Strings]] ​for full details.
-<​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>​+
  
 ==== Command File Parameters P1 thru P8 ==== ==== Command File Parameters P1 thru P8 ====
symbol_substitution.txt · Last modified: 2018/11/20 22:52 by lricker