Raw string literals
Terminal symbol in the grammar: RSTR_LIT.
There are also raw string literals that are preceded with the letter r (or R) and are delimited by matching double quotes (just like ordinary string literals) and do not interpret the escape sequences. This is especially convenient for regular expressions or Windows paths:
var f = openFile(r"C:\texts\text.txt") # a raw string, so ``\t`` is no tab
To produce a single “ within a raw string literal, it has to be doubled:
r"a""b"
Produces:
a"b
r”””” is not possible with this notation, because the three leading quotes introduce a triple quoted string literal. r””” is the same as “”” since triple quoted string literals do not interpret escape sequences either.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .