Title case is a style of writing that is used for the titles of articles, books, movies, and other works. The rules for writing in title case are:
1) Always capitalize the first word.
2) Capitalize all words except the following parts of speech:
- articles – a, an, the
- coordinating conjunctions – and, but, for, nor, or, so, yet
- short prepositions – to, in, up, from etc
Input : The quick brown fox jumps over the lazy dog. Output : The Quick Brown Fox Jumps over the Lazy Dog. Input : A tale of two cities Output : A Tale of Two Cities
- Make a list of all the words that have to be in lower case.
- For every word in the input, check whether it is in the above list or not.
- If yes then ignore the word, if no then capitalize its first character.
The implementation of the above algorithm is:
The Quick Brown Fox Jumps over the Lazy Dog. A Tale of Two Cities
- Python program to convert camel case string to snake case
- Python - Convert Snake case to Pascal case
- Python | Convert case of elements in a list of strings
- Python String Title method
- Python | Case Counter in String
- Python - Specific case change in String List
- Python String Methods | Set 1 (find, rfind, startwith, endwith, islower, isupper, lower, upper, swapcase & title)
- Python regex to find sequences of one upper case letter followed by lower case letters
- Pandas - Convert the first and last character of each word to upper case in a series
- numpy string operations | title() function
- Convert String to Float in Python
- Convert String to Long in Python
- Python | Convert String to Binary
- Python - Convert JSON to string
- Convert Decimal to String in Python
- Convert integer to string in Python
- Convert string to integer in Python
- Python | Convert None to empty string
- Python - Convert key-value String to dictionary
- How to convert string to integer in Python?
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.