A string is a sequence of characters
Hello world
“Hello world”
‘Hello world’
There are some standard escaped characters included in Green Tea’s string:
Sequence |
Meaning |
\n |
linefeed (LF or 0x0A (10) in ASCII) |
\r |
carriage return (CR or 0x0D (13) in ASCII) |
\t |
horizontal tab (HT or 0x09 (9) in ASCII) |
\v |
vertical tab (VT or 0x0B (11) in ASCII) |
\e |
escape (ESC or 0x1B (27) in ASCII) |
\f |
form feed (FF or 0x0C (12) in ASCII) |
\\ |
backslash |
\$ |
dollar sign |
\” |
double-quote |
\[0-7]{1,3} |
the sequence of characters matching the regular expression is a character in octal notation, which silently overflows to fit in a byte (e.g. “\400” == “\000”) |
\x[0-9A-Fa-f]{1,2} |
the sequence of characters matching the regular expression is a character in hexadecimal notation |
\u{[0-9A-Fa-f]+} |
the sequence of characters matching the regular expression is a Unicode codepoint, which will be output to the string as that codepoint’s UTF-8 representation |
We recommend you use quotation marks for string until you remember the word that shouldn’t be used unquoted.