String literal
string is zero or more characters written inside single or double quotes.
You can use quotes inside a string, as long as they don't match the quotes surrounding the string:
var
{
var1 = "It's alright"
var2 = "He is called 'Johnny'"
var3 = 'He is called "Johnny"'
}
Single quotes
single quotes allow you to use the syntax of expressions within them.
The @
sign must be placed before the expressions.
dynamic
{
item(title = 'windows dir path: @sys.dir')
}
Double quotes
double quotes allow you to use the Escape Character inside them only.
The backslash (\
) escape character turns special characters into characters.
The sequence \"
inserts a double quote in a string:
var
{
var1 = "hello\"world"
// result: hello"world
}
The complete set of escape sequences is as follows:
\' | Single quote |
\" | Double quote |
\\ | Backslash |
\0 | Null |
\a | Alert |
\b | Backspace |
\f | Form Feed |
\n | New Line |
\r | Carriage Return |
\t | Horizontal Tab |
\v | Vertical Tab |
\uxxxx | Unicode escape sequence (UTF-16) \uHHHH (range: 0000 - FFFF) |
\xnnnn | Unicode escape sequence for character with hex value nnnn (variable length version of \uxxxx) |
\Uxxxxxxxx | Unicode escape sequence (UTF-32) \U00HHHHHH (range: 000000 - 10FFFF) |
This page is open source.
Noticed a typo? Or something unclear?
Improve this page on GitHub