How C # uses escape characters to correctly represent strings such as double quotes, single quotes, and so on asp.net

Source: Internet
Author: User

One, what is the escape character

  An escape character is a special type of Word constants, preceded by a backslash "/" followed by one or more characters. Have a specific meaning, different from the original meaning of the character, it is called "escape" character.

  second, the role of the escape character

Used primarily to represent control code that is not easily represented by generic characters. Its function is to eliminate the original meaning of the character immediately following; Replaces some special characters with a combination of ordinary characters, which is called "escape" because it alters the meaning of the original character representation, and represents the unseen character with a visible character, such as '/n ' to indicate a newline.

  Escape character symbols and their corresponding meanings  

Escape character Correspondence meaning

/' Single quotes
/"Double quote
Back slash
/0 Empty
/a warning (generating peak beep)
/b BACKSPACE
/F Page Change
/N Line Wrap
/R Enter
/T Horizontal Tabs
/V Vertical tab

Examples, such as: string mystr= "Volkswagen/" Computer/"learning"; The result of the output is: mass "computer" learning

   Iii. The meaning of the @ symbol

In C #, "c://temp" means that the path is c:/temp; and @ "c:/temp" means c:/temp; So, the role of @ is to ignore the role of the escape character

(Blind Love net Www.amhl.net)

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.