English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Java String toLowerCase() method converts all characters in the string to lowercase.
The syntax of the string toLowerCase() method is:
string.toLowerCase()
Without any parameters
Returns a string with all uppercase letters converted to lowercase letters
class Main { public static void main(String[] args) { String str1 = "Learn Java"; String str2 = "Java123"; //converted to lowercase letters System.out.println(str1.toLowerCase()); // "learn java" System.out.println(str2.toLowerCase()); // "java123" } }
From the above examples, you can see that toLowerCase() converts all uppercase letters to lowercase letters.
The toLowerCase() method can also use the locale as a parameter. This allows you to use the rules of the given locale settings (such as Turkish, Lithuanian, etc.) to convert characters in the string to lowercase.
The syntax is:
string.toLowerCase(Locale locale)
If the locale parameter is not passed, the default locale Locale.getDefault() is used.
To convert all characters in a string to uppercase, useJava String toUpperCase() Method.