C # Escape characters:
- A special character constant
- Start with a backslash "\" followed by one or several characters
- Have a specific meaning, different from the original meaning of the character, it is called "escape" character.
- It is used primarily to denote control codes that are not easily represented by ordinary characters.
- Its role is to eliminate the original meaning of the character immediately following it
- Use a combination of some ordinary characters to replace some special characters, because their combination changes the meaning of the original character representation, so called "escape"
- A character that cannot be seen by a visible character, such as ' \ n ' means a newline
Commonly used escape characters and their meanings:
\ ' Single quotation mark
\ "Double quotation marks
\ \ counter Slash
Air
\a Warning (beep-generated)
\b Backspace
\f Page Change
\ nthe line break
\ r Enter
\ t Horizontal tab
\v Vertical Tab
The Meaning of @:
@ in C # for forced non-escaped symbols, the escape character format ("\" + "one character") in it loses its function as a normal string processing
String str1 = "abc\n"; Here \ nthe default escape is a newline character string str2 = @ "abc\n"; This is not escaped here as a newline character, but as a normal string "\ n" (a string consisting of characters ' \ ' and ' n '), which is equivalent to str2 = "abc\\n";
The following two forms of equivalence
String FilePath = "C:\\users\\eniac\\desktop\\matrix\\a.txt";//each \ \ is an escape character that represents a single backslash ' \ ' string filePath = @ "C:\Users\ Eniac\desktop\matrix\a.txt "; Do not escape
C # translatable characters