Some methods of the String class

Source: Internet
Author: User

The String class has the following methods:

StartsWith (String prefix)

Boolean java.lang.String.startsWith (String prefix)

Tests If this string starts with the specified prefix.

Parameters:
prefix the prefix.
Returns:
true If the character sequence represented by the argument are a prefix of the character sequence by this String falseotherwise. Note also that would be true returned if the argument is a empty string or is equal to this String object as determine D by the equals(Object) method.
Since:
1.0
is to determine if the suffix in the string is a parameter prefix, and if it is true, return FALSE if it is not.
This can be used to identify audio files, such as MP3 files, in Android.
corresponding, there is a method,
endsWith (String suffix)
boolean java.lang.String.endsWith (String suffix)

Tests If this string ends with the specified suffix.

Parameters:
suffix the suffix.
Returns:
true If the character sequence represented by the argument are a suffix of the character sequence by this Object falseotherwise. Note that the result would be true if the argument are the empty string or is equal to this String object as deter Mined by the equals(Object) method.
can be used to determine whether a string begins with the suffix parameter.

Some methods of the String class

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.