NET/MASTER Network Control Language (NCL) Reference Manual
QUOTE
Built-in Functions
106126 Tandem Computers Incorporated 4–67
QUOTE The QUOTE built-in function adds leading and trailing user-specified quote characters
to a string.
QUOTE(
string
[,
quotechar
] )
string
specifies the string that is to be placed within quotes.
quotechar
specifies the character to be used as the quote character. If no character is
specified, the single (‘) or double (“) quote characters are used; NCL chooses
whichever of these quote characters occurs least within the string. If both occur
equally often (or not at all), NCL uses the double quote character.
A user-specified quote character must be one character long. It may be any single
character (including any unprintable character) and is placed at the start and end
of the output string.
Considerations
If the quote character appears in the string, it is repeated.
A null string results in a string of two quote characters.
Take care if the quoted string contains a quote character. Study the provided
examples for this built-in function.
Examples
In the following example, the string “this is a string” is prefaced and followed by the
default double quote (“) character. The output string is “this is a string”:
SAY QUOTE(this is a string)
In the following example, the null string is prefaced and followed by the quote
character X. The result is XX:
SAY QUOTE("",X)
The following examples are included to show how you can get the wrong results and
how to correct some problems you may encounter. Suppose you want to place the
string “IT’S A QUOTE” within quotation marks. You can try:
SAY QUOTE(IT’S A QUOTE)
The preceding example causes a compilation error because NCL cannot find a closing
single quotation mark (’). You attempt to overcome the error by coding the example as
follows:
SAY QUOTE(IT’S A QUOTE,’)