Dodo doc > Syntax > Literal Values > Text String Literals


Text string literals

Single line string literals

Text string literals are enclosed in double quotes. They can be prefixed by an encoding specifier which tells the compiler which encoding to use for storing the text string. Some encoding specifiers are:

o"	UTF-8
x" UTF-16LE little endian, e.g. Intel x86
X" UTF-16BE big endian, e.g. Sparc
L" Latin-1
A" ASCII

Text string literals do not define an escape character. Special characters should be escaped outside the literal.

Examples:

"blue"
o"Café"
"C:\Program files\NeoCo"
Rationale: encoding specifiers ensure that a text is stored using the correct encoding, which is important in a non-standardised environment. Defining an escape character means there is a special character which must itself be escaped, ruining character alignment. So dodo does not define one.

Multi line string literals

Multi-line string literals open each line with a double quote. Each line of the multi-line literal ends with the last character of the line or three double quotes. The last line of the multi-line literal ends with a double quote.

Examples:

"This continued
" text ends
" here."

"1. Item """
"2. Item """
"3. Item "
Rationale: the double quote before each line of a multi-line literal allows text to be easily aligned and indicates the literal continues on that line. The three double quotes to close a line can ensure that no invisible character enters the text string, allows text to be easily right-padded and is more text editor friendly.

^ 2.4.1. Number Literals

v 2.4.3. Special Characters