Java String toLowerCase() Method Example

There are two forms of String.toLowerCase()  methods.
  • toLowerCase()  - Converts all of the characters in this String to lower case using the rules of the default locale.
  • String toLowerCase(Locale locale)  - Converts all of the characters in this String to lower case using the rules of the given Locale.

Java String toLowerCase() Method Example

This is a complete example to demonstrate the usage of both toLowerCase() methods.
public class ToLowerCaseExample {
    public static void main(String[] args) {
        String str = "JAVAGUIDES";
        String subStr = str.toLowerCase();
        System.out.println(subStr);
        subStr = str.toLowerCase(Locale.ENGLISH);
        System.out.println(subStr);
    }
}

Output:
javaguides javaguides 

Reference



Comments