Given a string str in camelCase format, the task is to convert the string into a readable form.
Input: str = “ILoveGeeksForGeeks”
Output: I love geeks for geeks
Input: str = “WeLoveToCode”
Output: We love to code
Approach: The string is camelCased that means words are not separated by spaces instead every capital letter means a new word has begun. In order to improve its readability, we convert it into sentence case. Given below is the code for the conversion. We traverse through the string and then whenever we encounter a lowercase we print it as such. When we encounter an uppercase letter we output space followed by the uppercase character (after converting to lowercase) and then the rest of the characters.
Below is the implementation of the above approach:
I love geeks for geeks
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Convert camel case string to snake case in Java
- Convert Snake Case string to Camel Case in Java
- Camel case of a given sentence
- Extract and print words separately from a given Camel Case string
- Snake case of a given sentence
- gOOGLE cASE of a given sentence
- Frequency of smallest character in first sentence less than that of second sentence
- Lower case to upper case - An interesting fact
- Convert vowels into upper case character in a given string
- Check a given sentence for a given set of simple grammer rules
- Find the word from a given sentence having given word as prefix
- Convert the ASCII value sentence to its equivalent string
- String in Switch Case in Java
- Convert characters of a string to opposite case
- Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
- Toggle case of a string using Bitwise Operators
- Permute a string by changing case
- Remove all the palindromic words from the given sentence
- Print given sentence into its equivalent ASCII form
- Java program to count the characters in each word in a given sentence
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.