A review of the string method (JDK1.7)

Source: Internet
Author: User

The following are the contents of the JDK in the Chinese document, only for learning reference use: Http://tool.oschina.net/apidocs/apidoc?api=jdk-zh
public intlength()
Returns the length of this string. (Length method in interface Charsequeue)
public BooleanIsEmpty()
When and only if length () is0When you returntrue。
Public CharcharAt(int index)
Returned at the specified index.charValue. (Length method in interface Charsequeue)
public voidGetChars(int srcbegin, int srcend, char[] DST, int dstbegin)
Copies the character from this string to the target character array.
public Booleanequals(Object AnObject)
Compares this string to the specified object.
public Booleancontentequals(StringBuffer SB)
This string is associated with the specifiedStringBufferComparison.
public Booleancontentequals(Charsequence CS)
This string is associated with the specifiedCharSequenceComparison.
public BooleanEqualsignorecase(String anotherstring)
Add thisStringwith anotherStringComparisons, regardless of case.
public intCompareTo(String anotherstring)
Compares two strings in a dictionary order. The comparison is based on the Unicode values of the individual characters in the string.
public intComparetoignorecase(String str)
Compares two strings in a dictionary order, regardless of case.
Public StringReplace(Char OldChar, char Newchar)
Returns a new string that is passed by using thenewCharReplace all occurrences of this stringoldCharTo get.
Public StringReplace(Charsequence target,charsequence replacement)
Replaces the substring of the target sequence of all matching literals of this string with the specified literal substitution sequence.
Public StringReplacefirst(string regex, string replacement)
Replaces this string with the given replacement to match the first substring of a given regular expression.
Public StringReplaceAll(String regex,string replacement)
Replaces this string with the given replacement for all substrings that match the given regular expression.
Static StringvalueOf(Boolean B)
Returns a string representation of a Boolean parameter.
Static StringvalueOf(char c)
Returns a string representation of the char parameter.
Static StringvalueOf(char[] data)
Returns a string representation of a char array parameter.
static String valueOf(char[] data, int offset, int count)
ReturnA string representation of a specific subarray of char array parameters.
static String valueOf(double D)
ReturnThe string representation of the double argument.
static String valueOf(float f)
Returnthe string representation of the float parameter.
static String valueOf(int i)
Returnthe string representation of the int parameter.
static String valueOf(long L)
Returnthe string representation of the long parameter.
static String valueOf(Object obj)
Returnthe string representation of the Object parameter.
IndexOf
Returns the index at which the specified character first appears in this string.
IndexOf
Returns the index at the first occurrence of the specified character in this string, starting the search from the specified index.
IndexOf
Returns the index at which the specified substring first appears in this string.
IndexOf
Returns the index of the first occurrence of the specified substring in this string, starting at the specified index.
LastIndexOf
Returns the index of the specified character at the last occurrence in this string.
LastIndexOf
Returns the index of the last occurrence of the specified character in this string, starting at the specified index to reverse-search.
lastIndexOf (String str)
Returns the index of the rightmost occurrence of the specified substring in this string.
LastIndexOf
Returns the index of the last occurrence of the specified substring in this string, starting at the specified index to reverse the search.
ToCharArray ()
Converts this string to a new character array. (Arrays.sort () can be used to sort operations after converting to an array)
contains (Charsequeue s)
Returns True when and only if this string contains a sequence of specified char values.




public intCodepointat(int index)
returns the character (Unicode code point) at the specified index.
public intCodepointbefore(int index)
Returns the character (Unicode code point) before the specified index
public intCodepointcount(int beginindex, int endIndex)
return thisStringThe number of Unicode code points in the specified text range.
public intoffsetbycodepoints(int index, int codepointoffset)
return thisStringFrom the givenindexOffset atcodePointOffsetThe index of a code point.
Public byte[]getBytes(String charsetname) throws Unsupportedendodingexception
Uses the specified character set to apply thisStringEncodes a byte sequence and stores the result in a new byte array.
Public byte[]getBytes(Charset Charset)
Use the given charset to apply thisStringEncodes into a byte sequence and stores the result in a new byte array.
Public byte[]getBytes()
Use the default character set of the platform to set thisStringEncodes a byte sequence and stores the result in a new byte array.
public Booleanregionmatches(int toffset, String other, int ooffset, int len)
Tests whether two string regions are equal.
public Booleanregionmatches(Boolean ignoreCase, int toffset, String other, int ooffset, int len)
Tests whether two string regions are equal.
public BooleanStartsWith(String prefix, int toffset)
Tests whether the substring starting at the specified index begins with the specified prefix.
public BooleanStartsWith(String prefix)
Tests whether this string starts with the specified prefix.
public BooleanEndsWith(String suffix)
Tests whether this string ends with the specified suffix.










A review of the string method (JDK1.7)

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.