Class String: Selected Methods


 o public int length()
 o public char charAt(int index)
 o public int compareTo(String other)
Compares two strings lexicographically. It can be used to sort strings.
 o public boolean equals(Object other)
 o public boolean equalsIgnoreCase(String other)
 o public boolean startsWith(String prefix [, int start_index])
 o public boolean endsWith(String suffix)
 o public boolean regionMatches([boolean ignoreCase,] int start_index, String other, int start_index_other, int len)
 o public int indexOf(String other [, int startindex])
 o public int lastIndexOf(String other [, int startindex])
 o public String substring(int start_index[, int end_index])
 o public String replace(char oldChar, char newChar)
 o public String toLowerCase()
 o public String toUpperCase()
 o public String trim()
Removes white space from both ends of this string.
 o public String toString()
This object (which is already a string!) is itself returned.
 o public static String valueOf(Primitive Datatype value)
Returns the string representation of the primitive datatype.

Java Tutorial - Standard Classes Jens Trapp, 1997