![]() |
VOOZH | about |
In Java, we can use regular expressions to make the first character of each word in Uppercase as the word is represented as a String and string is the collection of characters. So, in Java, we can use pattern and matcher class methods to find the first character of a word and then replace it with its uppercase letter.
In this article, we will discuss how to make the first character of each word in Uppercase using regex.
Input: geeks for geeks
Output: Geeks For GeeksInput: hello world
Output: Hello World
Below is the Regular Expression to make the first character of each word in Uppercase.
Geeks For Geeks
\\b\\w) to identify the first letter of each word.