C # 14th character method, escape character, String method

Source: Internet
Author: User

The content of this section:

1: Definition of character

2: Method of the character

3: Escape character

4: Introduction to Strings

5: String method

1: Definition of character

Char corresponds to Unicode one by one, with a char of 2 bytes.

2: How to use the characters:

Instance:

 Static voidMain () {CharA ='a'; Charb ='0'; Charc ='A'; if(Char. Isletter (a)) {//Judgment lowercase Console.WriteLine ("A is {0} lowercase, and uppercase is {1}"AChar.            ToUpper (a)); }            if(Char. IsDigit (b)) {//Determine if the data is Console.WriteLine ("B is the {0} number;", B); } Console.WriteLine (Char. ToLower (c));        Convert to lowercase console.readkey (); }
3: Escape character

4: Introduction to Strings

Character set and character encoding relationships:

Commonly used character sets and character encodings:

View of the ASCII code table:

5: Method of String

1: Convert String to Size

static void Main ()        {            string res = "Jack";            char S1 = ' s ';            Console.WriteLine (Res. ToUpper()); The string becomes uppercase             Console.WriteLine (Char. ToUpper(S1)); The character becomes capitalized            Console.readkey ();        }

2: Comparison of strings

Method:

1: = =

2:string.equals (ARG1,ARG2) # #返回布尔值

3:string.compare (Arg1,arg2,[true|false]) # #可选的是true or False indicates whether the case of a character can be ignored

namespaceHelloWorld {classHello {Static voidMain () {stringres ="Jack"; stringRes2 ="Jack"; Console.WriteLine (string.            Equals (Res,res2)); Console.WriteLine (string.                Compare (Res,res2));        Console.readkey (); }    }}//true//0

Description under: Compare Method:

C # 14th character method, escape character, String method

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.