The toLowerCase() method converts all characters in the string to lowercase characters.
Example
Syntax of toLowerCase()
The syntax of the string toLowerCase() method is:
string.toLowerCase()
Here, string is an object of the String class.
toLowerCase() Parameters
The toLowerCase() method does not take any parameters.
toLowerCase() Return Value
- returns a string with all upper case letters converted to lowercase letters
Example: Java toLowerCase()
As you can see from the above example, toLowerCase() converts all uppercase letters to lower case letters.
toLowerCase() With Locale Parameter
The toLowerCase() method can also take a locale as an argument. This allows you to convert characters in a string to lowercase using the given Locale (such as: Turkish, Lithuanian etc.) rules.
Its syntax is:
string.toLowerCase(Locale locale)
If you do not pass the locale parameter, the default locale, Locale.getDefault(), is used.
To learn more, visit Java toLowerCase() With Locale.
To convert all characters in a string to upper case characters, use the Java String toUpperCase() method.