Java String Handling

Convert first character of String to lowercase in Java example

Convert first character of String to lowercase in Java example shows how to make first character of string lowercase in Java. Example also shows various approaches to convert first character of string to lowercase.

How to convert first character of String to lowercase in Java?

You can use any of the below given approaches to make first character of string lower case in Java.

1) Make first character lower case using Character class and char array

Convert the String to character array, make first element of an array lowercase and finally create string from modified char array as given below.

Output

2) Make first character lower case using substring method

Output

We took the first character of the String, made it lowercase and then joined it with the rest of the String using substring method.

3) Make first character lower case using Character class and charAt method

Output

This approach is similar to the substring approach. We took first character of the string using charAt method, made it to lowercase using toLowerCase method of Character class and then joined it with the rest of the String.

4) Make first character lower case using Apache Commons

Finally, if you are using Apache Commons library, you can use uncapitalize method of StringUtils class to make first character of string lower case as given below.

Output

Visit String examples to learn more about Java Strings. Please let us know your views in the comments section below.

Want to learn quickly?
Try one of the many quizzes. I promise you will not be disappointed.