"First season of Java" and the like (the common methods for string classes are small)

Source: Internet
Author: User
Tags array to string

The following constructor methods and some common methods for the string class are:

/* Strings: A string of data consisting of multiple characters. It can also be seen as a character array. * By looking at the API, you know that * A: the string literal "abc" can also be seen as a string object. * B: The string is a constant, and once assigned, it cannot be changed. *  * Construction Method: * public string (): Empty construct *public string (byte[] bytes): Convert byte array to string *public strings (byte[] Bytes,int Index,int Leng TH): Convert a portion of a byte array to a string *public string (char[] value): Convert the character array to a string, *public string (char[] Value,int index,int count): Turn a part of a character array into a string *public string (string original): The method of turning a string constant value into a string * * string: note (array is not the length method) * public int Length () : Returns the length of this string. */

/* * String class's judgment function: * Boolean equals (Object obj): Compares the contents of a string to the same, case-sensitive * Boolean equalsignorecase (String str): Compares the contents of a string Ignore Case * Boolean contains (String str): Determines whether a large string contains a small string * Boolean StartsWith (String str): Determines whether a string begins with a specified string * Boolean ENDSWI Th (String str): Determines whether the string ends with a specified string * Boolean IsEmpty (): Determines whether the string is an empty string. *  * Note: * String contents are empty and string objects are empty. * String s = "";//boolean isEmpty (); Is the judge here, the contents of the empty string * string s = null;//This is empty, is the object is empty, there is no this object. */
Because the method of the string class is too much, the specific content and functionality can be viewed through the API documentation.

Here are a few small cases for the string class.

"First season of Java" and the like (the common methods for string classes are small)

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.