C # Escape Character Summary

Source: Internet
Author: User
Tags printable characters

Escape Character \
· A special character constant;
· Starts with a backslash "\", followed by one or several characters.
· It has a specific meaning. It is called "escape" because it is different from the original meaning of the character.
· It is mainly used to indicate control codes that are not easily represented by general characters.
· Its function is to eliminate the original meaning of the character following it
· Use a combination of some common characters to replace some special characters. Because the combination changes the meaning of the original character representation, it is called "escape"
· Use visible characters to indicate invisible characters. For example, '\ n' indicates line feed.
Example: textbox. Text = "you are \" Genius \ ", haha! "
What is displayed?
Show: you are a "genius" Haha
Common escape characters and their meanings
Meaning of escape characters
\ 'Single quotes
\ "Single quotes
\ Backslash "\"
\ 0 null character (null)
\ A bell
\ B Return
\ F go to paper form
\ N line feed
\ R press ENTER
\ T jump horizontally to the next tabulation position
\ V vertical hop (vertical tabulation)
ASCII contains some non-printable characters, such as line breaks and bell rings. These characters must be directly written to the ASCII value for output. These ASCII characters do not have any regularity, are less readable and hard to remember, for this reason, people have invented escape characters to replace ASCII values, so as to get rid of the disadvantages of ASCII and facilitate people's use.
In C #, what does @ indicate?
For example
String svspath = @ "" + this. openfiledialog1.filename;
What does he mean?
---------------
In C #, "C: \ Temp" indicates that the path is c: \ temp.
@ "C: \ Temp" indicates c: \ Temp
Therefore, @ should be used to ignore escape characters.
Are you sure you understand this correctly ?????????????
What should I do if I want to display "\ t?
Response. Write ("\" \ t \"");
Display result: "\ t"
When I wrote a VB.net program today, I forgot the escape double quotation marks of VB.net. I tried to use \ "to indicate it, but an error occurred! As I used to write C # code, I finally figured out that in VB.net, I used to use two double quotes to represent "". Now, only these are posted. Please try again later!
C #
Escape Character name

\ 'Single quotes

\ "Double quotation marks

\ Backslash

\ 0 null characters

\ A exclamation point

\ B Return

\ F form feed

\ N New Line

\ R press ENTER

\ T horizontal Tab

\ V vertical Tab
--------------
VB.net
Escape Character name
"":"
Member Constants
---------------------------------------------------------------------------
CRLF vbcrlf CHR (13) + CHR (10) Press enter/line feed combo. (Controlchars. CRLF)
Cr vbcr CHR (13) carriage return.
Lf vblf CHR (10) line break.
Newline vbnewline CHR (13) + CHR (10) newline.
The latest. Net class library, C #, and VB.net, can automatically adapt to environment changes:
Environment. newline
For example, dim str1 as string = "" & Environment. newline & ""
C # escape characters

Meaning of escape characters
\ N carriage return line feed
\ T jump horizontally to the next tabulation position
\ V vertical hop
\ B Return
\ R press ENTER
\ F go to paper form
\ Backslash "\"
\ 'Single quotes
\ A bell
\ DDD 1 ~ Three octal characters
\ Xhh 1 ~ 2-digit hexadecimal number
Output behavior change \ r \ n in the text box
Escape characters in C:
\ N ------------------------- line feed
\ R ------------------------- press ENTER
\ T ------------------------- Tab
\ B ------------------------- return
\ F --------------------------- form feed
\ 0 ------------------------- empty symbol
\ "------------------------- Double quotation marks
\ ''' ----------------------------- Single quotes
\ ------------------------- Backslash
Another special feature is the @ number. As long as the @ number is added before the statement, it means that all escape operations including the escape characters following the @ number are not performed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.