Java

302
3679 reads

February 22, 2013

toUpperCase() and toLowerCase()


The method toLowerCase( ) converts all the characters in a string from uppercase to lowercase. The toUpperCase( ) method converts all the characters in a string from lowercase to uppercase.

214
3936 reads

February 22, 2013

Using trim()


Returns a copy of the string, with leading and trailing whitespace omitted.

355
5963 reads

February 22, 2013

Substring replacement


String substring(int beginIndex,
int endIndex)

284
4992 reads

February 22, 2013

indexOf() and lastIndexOf()


These two methods are overloaded in several different ways. In all cases, the methods return the index at which the character or substring was found, or –1 on failure.

248
4995 reads

February 22, 2013

equals() vs ==


== : is a reference comparison ie both objects point to the same memory location
equals() : evaluates to the comparison of values in the objects

255
4890 reads

February 22, 2013

equals() and equalsIgnoreCase


equalsIgnoreCase(String anotherString) :

190
3961 reads

February 22, 2013

getChars Demo


Example show use of getChars (). Copies characters from this string into the destination character array.

265
4950 reads

February 22, 2013

Override toString()


toString() method in Java is used to provide clear and concise information about Object in human readable format.

47
2311 reads

February 22, 2013

Using Concatenation to Prevent Long Lines


Example shows how to use string concatenation (+ can be used)to prevent long lines.

154
2456 reads

February 22, 2013

Construct String from Subset of Char Array


Example shows how to construct a new String by decoding the specified array of bytes using the platform's default charset.

String 's2' :
Parameters: