.toLowerCase()
Published Feb 22, 2023
Contribute to Docs
The .toLowerCase()
method converts all the characters of a string to lowercase characters in Java.
Note: This method is locale sensitive, in consequence it might produce unexpected results because it takes into account the user’s locale, particularly when the string represents locale-specific values, e.g. date or time.
Syntax
upperCaseString.toLowerCase();
Where upperCaseString
is the string with some or all upper case characters to be converted.
Example
This example converts uppercase characters to lowercase characters:
// Example.javapublic class Example {public static void main(String[] args){String S1 = new String("ThiS IS an EXAMple");System.out.println(S1.toLowerCase());}}
This outputs the following:
this is an example
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.