Saturday, 12 September 2015

Java String toLowerCase()

Java String toLowerCase()

The java string toLowerCase() method returns the string in lowercase letter. In other words, it converts all characters of the string into lower case letter.
The toLowerCase() method works same as toLowerCase(Locale.getDefault()) method. It internally uses the default locale.

Signature

There are two variant of toLowerCase() method. The signature or syntax of string toLowerCase() method is given below:
  1. public String toLowerCase()  
  2. public String toLowerCase(Locale locale)  
The second method variant of toLowerCase(), converts all the characters into lowercase using the rules of given Locale.

Returns

string in lowercase letter.

Java String toLowerCase() method example

  1. public class StringLowerExample{  
  2. public static void main(String args[]){  
  3. String s1="JAVATPOINT HELLO stRIng";  
  4. String s1lower=s1.toLowerCase();  
  5. System.out.println(s1lower);  
  6. }}  

Output:
javatpoint hello string

No comments:

Post a Comment