Character types for C #

Source: Internet
Author: User
Tags character set control characters

In addition to numbers, computer processing of information, mainly is the character. Characters include numeric characters, English letters, expression symbols, and so on, C # provides character types in accordance with internationally recognized standards, using the Unicode character set. Unicode has a standard character length of 16 bits, which can be used to represent most languages in the world. You can assign a value to a character variable in the following ways, such as:

Char c= ' A ';

Alternatively, we can assign a value (prefix \u) to a character variable directly through the decimal escape character (prefix \x) or Unicode notation, as follows the assignment of the character type variable is correct:

Char c= ' \x0032 '; //

Char c= ' \u0032 '; //

Note: in C and C + +, the value of a character variable is the Ascⅱ code represented by the variable, and the value of a character variable is part of an integer that can be assigned and evaluated with an integer for a character variable. And this is forbidden in C #.

As in C, C + +, there is still an escape character in C # that is used to substitute special control characters in the program.

Table 4-2 escape characters (escape sequences)

Escape character name
\ '     single quote
\ '     double quotation mark \     backslash
\a     exclamation mark (Alert)
\b     backspace
\f     New line
\ r \ n     enter
\ t     horizontal tab
\v     Vertical tab
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.