3.1.2. Character Type

Source: Internet
Author: User

Characters include letters, numbers, punctuation marks, and special characters. The numbers and expressions of characters in different character sets are different. C # uses the Unicode character set. The length of a Unicode standard character is 16 characters.


The character type (char) in C # Corresponds to the structure system. Char in the. NET class library. InProgramEach declared char type variable creates a system. Char
Structure. Strictly speaking, the struct type is also a special Integer type. Its value range is the same as that of the ushort type. The C # compiler is responsible for converting integers and characters within the specified range.

 
CharX= 'A';

Character type (char): use single quotes;

String type (string): Double quotation marks are used.

C # uses the Unicode character set. A single Chinese character can also be used as a character.

CharY= 'Quantity';

In C #, use the Backslash "\" to guide escape characters.

 
CharZ= '\'';

Common escape characters in C #

Escape Character character name Escape Character character name Escape Character character name Escape Character character name
\' Single quotes \ F Form feed \ 0 NULL Character \ T Horizontal Tab
\" Double quotation marks \ N Line feed \ Alert (Bell) \ V Vertical Tab
\\ Slash \ R Enter \ B Return    

In C #, use @ to cancel the escape of the backslash.

 
StringPath= @"F: \ projects \";

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.