December
17th,
2015
String Literals
String literals may contain more than just ASCII characters. The default encoding is UTF-8, which provides a wide range of international symbols. Additionally, Monty string literals support various escape sequences in order to allow for the insertion of special characters:
String mongolianTitle := "Гарчиг" Char germanAE := 'Ä' String snowflakes := "❄ ❅ ❆ ❇ ❈ ❉ ❊ ❋" println("\u03C0 is greater that 3") println("Line 1\nLine 2\x00") println("A string with \" a quotation mark ")
Escape Sequences
The string literals support several escape sequences, introduced by a backslash. The following escape sequences are possible:
\\ |
backslash |
\' |
single quote |
\" |
double quote |
\t |
horizontal tab |
\v |
vertical tab |
\n |
linefeed |
\f |
formfeed |
\r |
carriage return |
\uXXXX |
a unicode character with 16 bit value XXXX |
\xXX |
a single byte with the 8 bit value XX |