|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--java.lang.String
The String class represents strings of characters.
| Constructor Summary | |
String()
Create a new String of zero length. |
|
String(char[] data)
Create a new String that is a copy of an array of
characters. |
|
String(String value)
Create a new String that is a copy of the parameter
value. |
|
String(StringBuffer str)
Create a new String from a StringBuffer. |
|
| Method Summary | |
char |
charAt(int index)
Return the character at the specified offset from the start of the String. |
boolean |
equals(String anotherString)
Test the string with equality with another string. |
boolean |
equalsIgnoreCase(String anotherString)
Perform a case-insensitive comparison this string and another string. |
int |
indexOf(String str)
Finds the first occurance of the specified String in this String. |
int |
length()
Return the length of this String measured in characters. |
void |
setCharArray(char[] a)
Specify the array that should be used to hold the characters in the string. |
char[] |
toCharArray()
Return the character array containing the characters in the string. |
String |
toString()
Return a reference to this String. |
static String |
valueOf(int i)
Create a new string which is the decimal value of an integer. |
static String |
valueOf(int i,
String val)
Convert an integer into a string and place the result into an existing string. |
| Methods inherited from class java.lang.Object |
equals |
| Constructor Detail |
public String()
String of zero length.public String(String value)
String that is a copy of the parameter
value.value - the String to make a copy of.public String(char[] data)
String that is a copy of an array of
characters. The array of characters is copied, so that any changes
to the array are not reflected in the new string.data - the array of characters to make into a string.public String(StringBuffer str)
String from a StringBuffer.str - the StringBuffer to copy into the new String.| Method Detail |
public String toString()
String.String.public int length()
String measured in characters.String.
public char charAt(int index)
throws IndexOutOfBoundsException
String. An index of zero refers to the first character
in the string.index - offset into the String.String.public char[] toCharArray()
public void setCharArray(char[] a)
a - an array of characters that should replace the current string.public static String valueOf(int i)
Note that this method will allocate memory for a new string.
i - integer to convert to a string.
public static String valueOf(int i,
String val)
i - integer to convert to a string.val - string to store the result in. val must be long enough to
store the string value of i.public boolean equals(String anotherString)
anotherString - the string to compare with this string.public boolean equalsIgnoreCase(String anotherString)
anotherString - the string to compare with this string.public int indexOf(String str)
str - the String to search for.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||