Introduction: The first brother to blog Park, but also just one. NET for beginners, first in the training structure to learn. NET, look to everyone to take care of. At the beginning, this is the first brother of the blog, talking about the escape characters in C #, the following collection of some C # common escape characters, such as summary of incomplete, please add, thank you here! Words don't say much, get to the chase.
First, the escape characters in C # include @ and backslash (\), which is specifically \ escaped here. The escape character is used because some characters have a special meaning in C #, so the use of these characters (such as the output) is problematic, so the escape character is used.
First list the escaped characters summed up by the younger brother, and then the specific explanation.
The meaning of escaping character escaping characters
\ nthe carriage return to newline.
\ r Enter
\ t jumps horizontally to the next tab position
\v Vertical Jump Lattice
\b Backspace
\ r Enter
\f Paper Change page
\ \ backslash character "\"
\ ' Single-quote character
\a Ringing Bell
Space
\DDD the characters represented by the number of octal digits
\xhh the characters represented by hexadecimal digits
Explain some of the escape characters:
1.\t: tab, to align the output. A tab character occupies 8 characters. Column:
Console.WriteLine ("Aaa\taaa");
Console.WriteLine ("Aaaaaaaaaaaaaaaaaaaaaaaaaaaa");
AAA AAA
Aaaaaaaaaaaaaaaaaaaaaaaaaaaa
Therefore, if the number of characters is greater than 8, the tab will fail, and two or more tabs can be entered to resolve.
2.\v: Horizontal tab, should be similar to \ t usage, and not used
3.\b and not back to delete.
Example: Console.Write ("Boundless horizon is My love \b");
At this point the output cursor is under "Love", if there is an input covering "love"
In the example: Console.Write ("boundless tianya \b is My Love");
At this point, "Ya" is overwritten, not deleted.
4.\r \ n Difference
\ nthe return line, \ r The cursor jumps to the beginning of the line does not wrap
Console.WriteLine ("Hello,itcas\nt");
\ n The result is:
Hello,itcas
T
Console.WriteLine ("Hello,itcas\rt");
\ r results are:
Tello,itcas
5.\f \ddd \xhh is not used, look at you big God detailed.
Then simply say @ Escape, @ put in front of the string can be de-escaped, at this time, to output "enter two" ".
Summary: Younger brother came to the arrival, on these days to learn one of the escape character to talk about their own views, there are said wrong and not the whole place to look at your opinion, and to the younger brother to add. Finally, I hope that you will accommodate the younger brother and help little brother quickly into the ranks of the program ape.
On the escape characters of C #