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
- Camel case of a given sentence
- gOOGLE cASE of a given sentence
- Snake case of a given sentence
- String in Switch Case in Java
- Permute a string by changing case
- Toggle case of a string using Bitwise Operators
- Convert characters of a string to opposite case
- Convert the ASCII value sentence to its equivalent string
- Lower case to upper case - An interesting fact
- Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
- Reverse the Sentence using Stack
- Calculate the difficulty of a sentence
- Split a sentence into words in C++
- Remove consecutive alphabets which are in same case
- Case-specific Sorting of Strings
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.