Programming Tips - General title case

Date: 2019nov2 Keywords: titlecase Q. General title case A. I have functions in several languages here that naively convert a string to title case. ie first letter of every word capitalized. But they don't take into account the many exceptions in English and other languages. - Generally in English titles we don't capitalize small words like "a", "in", "or" etc. Less than or equal to 2 letters. ==> Its easy to make this rule - But "I" is capitalized ==> As far as I know "I" is the only exception - Some longer words are not capitalized - eg "iPhone", "iCal". ==> Make a small list - Acronyms are always capitalized - eg its "NASA", not "Nasa". ==> If a word is all upper case, assume its an acronym and don't change its case - Another approach is to check your new case of a word in a dictionary:
grep NASA /usr/share/dict/words
But, "iPhone" isn't in that file