[Summary-basic usage of string and char]

Source: Internet
Author: User

Basic usage of the string class

String is the alias of string, just as Int Is int32 and long is the alias of int64. These structures are derived from the valuetype class.

 

Attribute or Method

Description

Equals ()

Determine whether two string objects are equal

Compareto ()

 

Startwith (s)

Determines whether a string starts with S.

Endwith (s)

Determines whether a string ends with S.

Gethashcode ()

Obtains the hash value of a string.

Indexof (char)

Index position of the first occurrence of a character (string) in a string

Indexofany (char [])

Index position where the character array appears for the first time in the string

Lastindexof (char)

The last index position of the character (string) in the string

Lastindexofany (char [])

The last index position of the character array in Str

Substring ()

Substring

Replace ()

Replace old characters with new characters

Tolower ()

Converts a specified string to lowercase.

Toupper ()

Converts a specified string to uppercase.

Trim ()

Remove spaces on both sides of the string

Trimend ()

Remove spaces on the right of the string

Trimstart ()

Remove the space on the left of the string.

Tostring ()

Convert to string

Split ()

Splits a string based on a specific character.

Join ()

Connect strings based on specific characters

 

Basic usage of char

Char is of the struct type. Most methods of the char structure are static methods, and at least one character parameter is accepted.

Attribute or Method

Description

Isdigit ()

Determines whether the entered character is a number.

Isletter ()

Determines whether the entered character is a letter.

Islower ()

Determines whether the input character is a lowercase letter.

Isupper ()

Determines whether the input character is an uppercase letter.

Tolower ()

Converts the input characters to lowercase letters.

Toupper ()

Converts the input characters into uppercase letters.

Ispunctuation ()

Determines whether the entered character is a punctuation mark.

Issymbol ()

Determines whether the entered character is a symbol.

Iswhitespace ()

Determines whether the entered character is a blank character (replacement character, tab, space, etc)

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.