C # escape characters

Source: Internet
Author: User
Tags printable characters

C # escape characters

 

· 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 characters that follow it. Some common character combinations are used to replace some special characters, because their combinations change the meaning of the original character representation, therefore, it is called "escape"

· Use visible characters to represent invisible characters. For example, '\ n' indicates line feed. For example: textbox. Text = "you are \" Genius \ ", haha! "Show what?

Show: you are a "genius", a common escape character, and its meaning.

\ 'Single quotation marks \ "single quotation marks \ backslash character" \ "\ 0 null character (null) \ A bell \ B Return

\ F go to paper form

\ N newline \ r carriage return

\ T jump horizontally to the next tabulation position \ v vertical grid (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 [email protected] "" + this. openfiledialog1.filename; what does it mean ---------------

In C #, "C: \ Temp" indicates that the path is c: \ Temp and @ "C: \ Temp" indicates c: \ temp.

 

 

 

 

 

 

Therefore, the role of @ should be to ignore the role of 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

 

 

 

 

 

 

Effect description

---------------------------------------------------------------------------

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 newest, C #, and VB.net common methods in the most standard. Net class library that can automatically adapt to environment changes: environment. newline

For example, dim str1 as string = "" & Environment. newline & "" C # Escape Character

Meaning of Escape Character \ n carriage return

\ T jump horizontally to the next tabulation position \ v vertical jump grid \ B backspace \ r press ENTER

\ F go to paper form feed \ backslash character "\" \ 'single quotation mark character \ a bell

\ DDD 1 ~ The three octal characters \ xhh 1 ~ The character represented by the two-digit hexadecimal number is output in the text box \ r \ n

C:

\ N character wrap \ r character carriage return \ t --------------------------- tab \ B ------------------------- return \ f ----------------------- form feed \ 0 character empty symbol \ "character 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.