Quote:
Originally Posted by KevinH
There is no universal titlecase function that works on every string in every language as even in English the rules for what gets titlecased are not generally agreed upon under certain styles or grammar rules. And yes if something is in all caps, title case generally ignores it as allcaps indicates it may be an abbreviation, or acronyms.
If you want to handle all caps cases then in your own python function replace do two things with the first lowercasing the string, and the second titlecases it. But be careful for acronyms.
|
Perhaps I did not explain myself clearly. It works the way I would expect for strings that contain no lowercase characters and it works for strings that have words with only initial capital or no capital letters. It does not work the way I would expect for strings that have words that are all capitalized and other words that have lower case letters.
If you change the line in titlecase.py about line 61
Code:
from:
if all_caps:
to
if toUpper(word) == word:
then it appears to work the way I would expect.