The
string type represents immutable text as a sequence of Unicode characters.
string is an alias for
System.String in .NET.
Remarks : String literals are delimited by the quotation mark (") character. The backslash character ( \ ) is used to encode certain special characters. The backslash and the next character together are known as an escape sequence. Escape sequences supported in F# string literals are shown in the following table.
| Character |
Escape sequence |
| Alert |
\a |
| Backspace |
\b |
| Form feed |
\f |
| Newline |
\n |
| Carriage return |
\r |
| Tab |
\t |
| Vertical tab |
\v |
| Backslash |
\\ |
| Quotation mark |
\" |
| Apostrophe |
\' |
| Unicode character |
\DDD (where D indicates a decimal digit; range of 000 - 255; for example, \231 = "ç") |
| Unicode character |
\xHH (where H indicates a hexadecimal digit; range of 00 - FF; for example, \xE7 = "ç") |
| Unicode character |
\uHHHH (UTF-16) (where H indicates a hexadecimal digit; range of 0000 - FFFF; for example, \u00E7 = "ç") |
| Unicode character |
\U00HHHHHH (UTF-32) (where H indicates a hexadecimal digit; range of 000000 - 10FFFF; for example, \U0001F47D = "👽") |