Methods of Class String –
int length()
Returns the number of characters that the invoking string contains.
char charAt(int i)
Returns the character at the specified index i within the invoking string.
int compareTo(String s)
Compares the invoking string with the string referred by s lexicographically, and returns the difference of the
Unicode of characters at the index where the Unicode of the characters differ, as int value. If both the strings are
same, zero is returned. Case of the characters is considered. If the invoking string is a substring within the string
referred by s or vice versa, starting from index 0, then the number of extra characters is returned as a int value.
int compareToIgnoreCase(String s)
Compares the invoking string with the string referred by s lexicographically, and returns the difference of the
Unicode of characters at the index where the Unicode of the characters differ, as int value. If both the strings are
same, zero is returned. Case of the characters is not considered. If the invoking string is a substring within the
string referred by s or vice versa, starting from index 0, then the number of extra characters is returned as a int
value.
boolean equals(String s)
Compares the invoking string with the string referred by s, for equality, and returns the boolean value true if
both the string are equal otherwise returns the boolean value false. Case of the characters is considered.
boolean equalsIgnoreCase(String s)
Compares the invoking string with the string referred by s, for equality, and returns the boolean value true if
both the string are equal otherwise returns the boolean value false . Case of the characters is not considered.
String substring(int si)
Forms a new string which is a substring of the invoking string, starting from index si till the last character, and
returns the binary address of the new string.
, String substring(int si,int li)
Forms a new string which is a substring of the invoking string, starting from index si till the character before the
character at index li, and returns the binary address of the new string.
String concat(String s)
Forms a new string after appending the copy of the string referred by s, to the end of the copy of the invoking
string, and returns the binary address of the new string.
boolean endsWith(String s)
Tests if the invoking string ends with the string referred by s, and returns the boolean value true if it is true else
returns the boolean value false.
boolean startsWith(String s)
Tests if the invoking string starts with the string referred by s, and returns the boolean value true if it is true else
returns the boolean value false.
int indexOf(int c)
Returns the index of the first occurrence of the specified character c within the invoking string.
int indexOf(String s)
Returns the index of the first occurrence of the string referred by s, within the invoking string.
int lastIndexOf(int c)
Returns the index of the last occurrence of the specified character c within the invoking string.
String replace(char oc,char nc)
Forms a new string after replacing all occurrences of character oc with character nc, in the invoking string, and
returns the binary address of the new string.
String replaceAll(String os,String ns)
Forms a new string after replacing all occurrences of the string referred by os with string referred by ns, in the
invoking string, and returns the binary address of the new string.
String toLowerCase()
Forms a new string after converting all the characters of the invoking string, to lower case, and returns the
binary address of the new string.
String toUpperCase()