How to convert a String to lowercase in Java
In this blog post, I will be explaining how you can convert a String to lowercase in Java. Consider the following code snippet:
</pre>package learnjava.strings;public class StringLowerCaseDemo {public static void main(String[] args) {String str = "Hello World";str = str.toLowerCase();System.out.println(str);}}<pre>
There is a String.toLowerCase method. This converts the String object on which it is invoked to lowercase and returns the converted String. So when you run the above code, you will get the following output:
hello world
Comments
Post a Comment