Skip to content

Commit fb0e4ab

Browse files
authored
Encode string escape chars with code formatting (#6261)
* Encode string escape chars with code formatting This makes it a bit more clear how to use them. * Fix up statement of result
1 parent 2bb54ed commit fb0e4ab

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/fsharp/language-reference/strings.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ String literals are delimited by the quotation mark (") character. The backslash
1515

1616
|Character|Escape sequence|
1717
|---------|---------------|
18-
|Backspace|\b|
19-
|Newline|\n|
20-
|Carriage return|\r|
21-
|Tab|\t|
22-
|Backslash|\\|
23-
|Quotation mark|\"|
24-
|Apostrophe|\'|
25-
|Unicode character|\u*XXXX* or \U*XXXXXXXX* (where *X* indicates a hexadecimal digit)|
18+
|Backspace|`\b`|
19+
|Newline|`\n`|
20+
|Carriage return|`\r`|
21+
|Tab|`\t`|
22+
|Backslash|`\\`|
23+
|Quotation mark|`\"`|
24+
|Apostrophe|`\'`|
25+
|Unicode character|`\uXXXX` or `\UXXXX` (where `X` indicates a hexadecimal digit)|
2626

2727
If preceded by the @ symbol, the literal is a verbatim string. This means that any escape sequences are ignored, except that two quotation mark characters are interpreted as one quotation mark character.
2828

@@ -36,7 +36,7 @@ let xmlFragment1 = @"<book author=""Milton, John"" title=""Paradise Lost"">"
3636
let xmlFragment2 = """<book author="Milton, John" title="Paradise Lost">"""
3737
```
3838

39-
In code, strings that have line breaks are accepted and the line breaks are interpreted literally as newlines, unless a backslash character is the last character before the line break. Leading whitespace on the next line is ignored when the backslash character is used. The following code produces a string `str1` that has value `"abc\n def"` and a string `str2` that has value `"abcdef"`.
39+
In code, strings that have line breaks are accepted and the line breaks are interpreted literally as newlines, unless a backslash character is the last character before the line break. Leading whitespace on the next line is ignored when the backslash character is used. The following code produces a string `str1` that has value `"abc\ndef"` and a string `str2` that has value `"abcdef"`.
4040

4141
[!code-fsharp[Main](../../../samples/snippets/fsharp/lang-ref-1/snippet1001.fs)]
4242

0 commit comments

Comments
 (0)