Skip to content

Clarify raw string literal multi-line rules for opening quotes and whitespace handling #47728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/csharp/language-reference/tokens/raw-string.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Raw string literals can span multiple lines:

The following rules govern the interpretation of a multi-line raw string literal:

- The opening quotes must be the last non-comment token on its respective line, and the closing quote must be the first non-comment token on its respective line.
- The opening quotes must be the last non-whitespace characters on their line, and the closing quotes must be the first non-whitespace characters on their line.
- Any whitespace to the left of the closing quotes is removed from all lines of the raw string literal.
- Whitespace following the opening quote on the same line is ignored.
- Any whitespace following the opening quotes on the same line is ignored.
- Whitespace only lines following the opening quote are included in the string literal.
- If a whitespace precedes the end delimiter on the same line, the exact number and kind of whitespace characters (for example, spaces vs. tabs) must exist at the beginning of each content line. Specifically, a space does not match a horizontal tab, and vice versa.
- The newline before the closing quotes isn't included in the literal string.
Expand Down
Loading