Common Methods for string strings

Source: Internet
Author: User
charAt(int index) Char ReturnscharValue.
equals(Object anObject) Boolean Compares the string with the specified object.
getBytes() Byte [] Use the default Character Set of the platformStringEncode the data as a byte sequence and store the results in a new byte array.

getBytes(String charsetName)
Byte [] Use the specified character setStringEncode the data as a byte sequence and store the results in a new byte array.
indexOf(String str) Int Returns the index of the first occurrence of the substring.
isEmpty() boolean When and only whenlength()Is0ReturnsTrue.
indexOf(int ch) Int Returns the index of the first occurrence of the specified character in this string.
length() Int Returns the length of this string.
matches(String regex) Boolean Indicates whether the string matches the given regular expression.
toCharArray() Char [] Converts a string to a new character array.
toString() String Returns the object itself (it is already a string !).
toUpperCase() String Use the rules of the default language environmentStringAll characters in are converted to uppercase letters
toLowerCase() String Use the rules of the default language environmentStringAll characters in are converted to lowercase letters.
valueOf(Object obj)  static String ReturnObjectParameter string representation.
trim()  String Returns a copy of the string, ignoring leading and trailing spaces.
equalsIgnoreCase(String anotherString)   boolean Set thisStringWith anotherStringComparison, case insensitive
endsWith(String suffix)  boolean Test whether the string ends with the specified suffix.
contains(CharSequence s)  Boolean Returns true if and only if the string contains the specified char value sequence.







Common Methods for string strings

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.