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.
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
Free Spring Boot Tutorial - 5 Hours Full Course
Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course