I'm looking for a function to convert a string of text that is in UpperCase to SentenceCase. All the examples I can find turn the text into TitleCase.
Sentence case in a general sense describes the way that capitalization is used within a sentence. Sentence case also describes the standard capitalization of an English sentence, i.e. the first letter of the sentence is capitalized, with the rest being lower case (unless requiring capitalization for a specific reason, e.g. proper nouns, acronyms, etc.).
Can anyone point me in the direction of a script or function for SentenceCase?
This is what I use (VB.NET). It works in most situations, including:
sentences beginning with characters other than A-Z. For example it will work for: "if you want $100.00 then just ask me".
But as for proper nouns and acronyms, well... there are always going to be situations in the English language where punctuation is not as simple. For example this script won't detect an ellipsis ("..."), or abbreviations (eg: "Mr. Jones lived on Magnolia Blvd. near Chris' house").
To address the problem completely you will need to produce a dictionary of all the possible abbreviations/punctuation's for the language, and keep the dictionary up-to-date! After considering this most will be happy with a compromise, otherwise just use Microsoft Word.
This works for me.
If you'd like to sentence case a string containing punctuation other than just periods: