symbol_substitution
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
symbol_substitution [2018/11/20 16:22] – clarifications lricker | symbol_substitution [2018/11/20 22:52] (current) – lricker | ||
---|---|---|---|
Line 9: | Line 9: | ||
- Use the **value** of a // | - Use the **value** of a // | ||
- Substitute (interpolate, | - Substitute (interpolate, | ||
- | - Substitute (interpolate, | + | - Substitute (interpolate, |
You'll find these techniques and uses of string substitution primarily in DCL command files, or scripts, which exploit many of the same programming techniques as those more modern scripting languages. | You'll find these techniques and uses of string substitution primarily in DCL command files, or scripts, which exploit many of the same programming techniques as those more modern scripting languages. | ||
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: |
< | < | ||
Line 111: | Line 111: | ||
</ | </ | ||
- | When you want a //literal __double__-quote mark// to appear in a literal | + | ...or surround some text with single quotes? -- like this: |
< | < | ||
- | $ WRITE sys$output "This is "" | + | This is ' |
- | | + | |
- | | + | |
</ | </ | ||
- | ...or: | + | These are pretty common use-cases -- See the wiki article [[Literal Quotes in DCL Strings]] |
- | < | + | |
- | $ DQUOTE = """" | + | |
- | $ WRITE sys$output "This is " + DQUOTE, " | + | |
- | $ ! This | + | |
- | $ ! | + | |
- | $ ! a single string | + | |
- | </ | + | |
- | + | ||
- | ...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 ' | + | |
- | </ | + | |
==== Command File Parameters P1 thru P8 ==== | ==== Command File Parameters P1 thru P8 ==== |
symbol_substitution.1542730963.txt.gz · Last modified: 2018/11/20 16:22 by lricker