Skip to content

Commit

Permalink
Update raw-string.md (#40869)
Browse files Browse the repository at this point in the history
Extra Info about string literals
  • Loading branch information
bigboybamo authored May 14, 2024
1 parent 125bebf commit 4fd9ead
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/csharp/language-reference/tokens/raw-string.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The following rules govern the interpretation of a multi-line raw string literal
- 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.
- 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 (e.g. spaces vs. tabs) must exist at the beginning of each content line. Specifically, a space does not match a horizontal tab, and vice versa.

You may need to create a raw string literal that has three or more consecutive double-quote characters. Raw string literals can start and end with a sequence of at least three double-quote characters. When your string literal contains three consecutive double-quotes, you start and end the raw string literal with four double quote characters:

Expand All @@ -32,6 +33,8 @@ If you need to start or end a raw string literal with quote characters, use the

Raw string literals can also be combined with [interpolated strings](./interpolated.md#interpolated-raw-string-literals) to embed the `{` and `}` characters in the output string. You use multiple `$` characters in an interpolated raw string literal to embed `{` and `}` characters in the output string without escaping them.

The raw string literal's content must not contain a set of contiguous `"` characters whose length is equal to or greater than the raw string literal delimiter length. For example, the strings `"""" """ """"` and `""""""" """""" """"" """" """ """""""` are well-formed. However, the strings `""" """ """` and `""" """" """` are ill-formed

Raw string literals were introduced in C# 11.

## See also
Expand Down

0 comments on commit 4fd9ead

Please sign in to comment.