In this article we will discuss how to capitalize first letter of each word in a String.Suppose given string is,

Now after converting first letter of each word, string will become,

This type of String is also called Camel Case.

Algorithm For Capitalizing First Letter of Each Word in String

  • Iterate over the string from beginning to end
    • For each character check its a white space or not.If its a white space then update a flag IS_SPACE true.
    • If its a character between ‘a’ to ‘z’ and flag IS_SPACE is true then just convert this character to upper case.

Complete code in Java is as follows,



Join LinkedIn Group of Python Professional Developers who wish to expand their network and share ideas.

You can also follow us On Twitter :

Click Here to Subscribe for more Articles / Tutorials like this.