String literals
Terminal symbol in the grammar: STR_LIT.
String literals can be delimited by matching double quotes, and can contain the following escape sequences:
Escape sequence | Meaning |
---|---|
\p | platform specific newline: CRLF on Windows, LF on Unix |
\r, \c | carriage return |
\n, \l | line feed (often called newline) |
\f | form feed |
\t | tabulator |
\v | vertical tabulator |
\ | backslash |
\” | quotation mark |
\’ | apostrophe |
\ ‘0’..’9’+ | character with decimal value d; all decimal digits directly following are used for the character |
\a | alert |
\b | backspace |
\e | escape [ESC] |
\x HH | character with hex value HH; exactly two hex digits are allowed |
\u HHHH | unicode codepoint with hex value HHHH; exactly four hex digits are allowed |
\u {H+} | unicode codepoint; all hex digits enclosed in {} are used for the codepoint |
Strings in Nim may contain any 8-bit value, even embedded zeros. However, some operations may interpret the first binary zero as a terminator.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .