Share via


String Members

Class Overview | This Package | All Packages

Constructors

Name Description
String() Allocates a new String containing no characters.
String(byte[]) Construct a new String by converting the specified array of bytes using the platform's default character encoding.
String(byte[], int) Allocates a new String containing characters constructed from an array of 8-bit integer values. Deprecated.
String(byte[], int, int) Construct a new String by converting the specified subarray of bytes using the platform's default character encoding.
String(byte[], int, int, int) Allocates a new String constructed from a subarray of an array of 8-bit integer values. Deprecated.
String(byte[], int, int, String) Construct a new String by converting the specified subarray of bytes using the specified character encoding.
String(byte[], String) Construct a new String by converting the specified array of bytes using the specified character encoding.
String(char[]) Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.
String(char[], int, int) Allocates a new String that contains characters from a subarray of the character array argument.
String(String) Allocates a new string that contains the same sequence of characters as the string argument.
String(StringBuffer) Allocates a new string that contains the sequence of characters currently contained in the string buffer argument.

Methods

Name Description
charAt(int) Returns the character at the specified index.
compareTo(String) Compares two strings lexicographically.
concat(String) Concatenates the specified string to the end of this string.
copyValueOf(char[]) Returns a String that is equivalent to the specified character array.
copyValueOf(char[], int, int) Returns a String that is equivalent to the specified character array.
endsWith(String) Tests if this string ends with the specified suffix.
equals(Object) Compares this string to the specified object.
equalsIgnoreCase(String) Compares this String to another object.
getBytes() Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array.
getBytes(int, int, byte[], int) Copies characters from this string into the destination byte array. Deprecated.
getBytes(String) Convert this String into bytes according to the specified character encoding, storing the result into a new byte array.
getChars(int, int, char[], int) Copies characters from this string into the destination character array.
hashCode() Returns a hashcode for this string.
indexOf(int) Returns the index within this string of the first occurrence of the specified character.
indexOf(int, int) Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index.
indexOf(String) Returns the index within this string of the first occurrence of the specified substring.
indexOf(String, int) Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
intern() Returns a canonical representation for the string object.
lastIndexOf(int) Returns the index within this string of the last occurrence of the specified character.
lastIndexOf(int, int) Returns the index within this string of the last occurrence of the specified character, searching backward starting at the specified index.
lastIndexOf(String) Returns the index within this string of the rightmost occurrence of the specified substring.
lastIndexOf(String, int) Returns the index within this string of the last occurrence of the specified substring.
length() Returns the length of this string.
regionMatches(boolean, int, String, int, int) Tests if two string regions are equal.
regionMatches(int, String, int, int) Tests if two string regions are equal.
replace(char, char) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.
startsWith(String) Tests if this string starts with the specified prefix.
startsWith(String, int) Tests if this string starts with the specified prefix.
substring(int) Returns a new string that is a substring of this string.
substring(int, int) Returns a new string that is a substring of this string.
toCharArray() Converts this string to a new character array.
toLowerCase() Converts this String to lowercase.
toLowerCase(Locale) Converts all of the characters in this String to lower case using the rules of the given locale.
toString() This object (which is already a string!) is itself returned.
toUpperCase() Converts this string to uppercase.
toUpperCase(Locale) Converts all of the characters in this String to upper case using the rules of the given locale.
trim() Removes white space from both ends of this string.
valueOf(boolean) Returns the string representation of the boolean argument.
valueOf(char) Returns the string representation of the char * argument.
valueOf(char[]) Returns the string representation of the char array argument.
valueOf(char[], int, int) Returns the string representation of a specific subarray of the char array argument.
valueOf(double) Returns the string representation of the double argument.
valueOf(float) Returns the string representation of the float argument.
valueOf(int) Returns the string representation of the int argument.
valueOf(long) Returns the string representation of the long argument.
valueOf(Object) Returns the string representation of the Object argument.