String Literals

Syntax

		" { letter | digit | specialCharacter | escapedCharacter } [ ...n ] "

Parameters

Notes:

  • To incorporate a backslash character in a string literal, you will need to escape the character by adding an extra backslash, so that it is represented as a double-backslash in a literal string. For example, the command Attach "\\" MyString concatenates a single backslash character on the end of the MyString variable.

  • Similarly, to represent a backslash in a filename literal, you will need to add an extra backslash in the path name. For example, "C:\\Folder\\File.txt".

Description

String literals are LDL+ primitive values that only have character significance. Refer to Numeric Literals for more information on literals that have numerical significance.

Note: A national string literal such as a Kanji character can only be compared to another national string literal.

Escape Characters

Escape characters, such as '\n', primarily have significance in particular execution contexts. Outside of these contexts any character that follows the escape character ('\') inside a literal is treated as an instance of itself – the '\' is ignored.

Non-printable Characters

This helps to specify non-character data values.

In addition to the ‘\xnn’ syntax to represent a character as a hexadecimal code, the ‘@xx@’ syntax can be used to specify non-character literal values, where ‘@’ character indicates the start of a hexadecimal constant and ‘xx’ indicates hexadecimal digits.

While using '@xx@' syntax, the value of 'xx' must be EBCDIC hexadecimal  characters. This is a variation of the general escape notation that can be used to include other non-printable characters in string literals, such as new line, tab, and line feed. For example, to represent a line feed character, use the '@25@' syntax, where 25 represents a line feed character in EBCDIC hexadecimal code.

Examples

Example 1

"This is a string literal"

Example 2

"So is this (*(*&#0-39-9"

Example 3

"With embedded \"delimiters\""

Example 4 (can be treated as string or numeric literal depending upon the usage context)

"987.123"