C # translatable characters

Source: Internet
Author: User

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

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.