Some functions of C # string

Source: Internet
Author: User

Create String:string (char[]) constructs a new string object using the specified string array

Copy (String) constructs a new string object with the specified string

    

Comparison functions: Compare (A, A, a, b) and A.compareto are equal to return 0, greater than the return positive, less than the return negative number;

Equals () determines equality

To determine whether it is empty: empty

Lengths: Length

Split (): You can get a series of substrings separated by the specified delimiter (you can specify a number of delimiters, the delimiter can be either a character or a string), join (), and connect some strings with the specified delimiter.

StartsWith (), EndsWith () determines whether to start or end with the specified string

ToUpper (), ToLower () convert case

Take substring Substring (int x, int L) from x followed by L long substring, Substring (int x) take x after all

IndexOf () returns the position of the specified character or string in the current string, and int LastIndexOf () returns the last occurrence of the specified character or string

Insert (int,string) inserts a specified string in the current string, and remove (int,int) deletes the specified number of characters from the specified position

Replace (string,string) string substitution

Trim () removes the specified character from the head and tail of the string, TrimStart () only deletes the string header, and TrimEnd () deletes only the trailing of the string.

Some functions of C # string

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.