String Literals

String literals (strlit) are enclosed in quotation marks (" ") and must only contain graphic characters. In other words, control characters (ASCII 0-31 and 127) cannot appear in a strlit. M attempts to use character text that appears outside of quotation mark delimiters according to context, which generally means as a local variable name.

To include a quotation mark (") within a strlit, use a set of two quotation marks ("" "").

Example:

       GTM>WRITE """"
       "
       GTM>
        

The WRITE displays a single quotation mark because the first quotation mark delimits the beginning of the string literal, the next two quotation marks denote a single quote within the string, and the last quotation mark delimits the end of the string literal.

Use the $CHAR function and the concatenation operator to include control characters within a string.

Example:

       GTM>WRITE "A"_$CHAR(9)_"B"
       A B
       GTM>
        

The WRITE displays an "A," followed by a tab (<HT>), followed by a "B" using $CHAR(), to introduce the non-graphic character.