File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
tutorials/scripting/gdscript Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -429,14 +429,22 @@ A string enclosed in quotes of one type (for example ``"``) can contain quotes o
429429two consecutive quotes of the same type (unless they are adjacent to the string edges).
430430
431431**Raw string literals ** always encode the string as it appears in the source code.
432- This is especially useful for regular expressions. Raw strings do not process escape sequences,
433- but you can "escape" a quote or backslash (they replace themselves).
432+ This is especially useful for regular expressions. A raw string literal doesn't process escape sequences,
433+ however it does recognize ``\\ `` and ``\" `` (``\' ``) and replaces them with themselves.
434+ Thus, a string can have a quote that matches the opening one, but only if it's preceded by a backslash.
434435
435436::
436437
437438 print("\tchar=\"\\t\"") # Prints ` char="\t"`.
438439 print(r"\tchar=\"\\t\"") # Prints `\tchar=\"\\t\"`.
439440
441+ .. note ::
442+
443+ Some strings cannot be represented using raw string literals: you cannot have an odd number
444+ of backslashes at the end of a string or have an unescaped opening quote inside the string.
445+ However, in practice this doesn't matter since you can use a different quote type
446+ or use concatenation with a regular string literal.
447+
440448GDScript also supports :ref: `format strings <doc_gdscript_printf >`.
441449
442450Annotations
You can’t perform that action at this time.
0 commit comments