I'm very confused about this. In most programming languages, there are string.ToUpperCase(), string.ToLowerCase(), sometimes Capitalize() (which capitalize the first letter of the string), even ToTitleCase() which capitalize every first letter of everyword.

But why isn't there any ToCommonSenseCase()? The one that capitalize the first letter of each sentence? Why doesn't any language have it? I thought it should be the first utility function to implement case-wise.

  • see On discussions and why they don't make good questions
    – gnat
    Commented Feb 23, 2019 at 4:21
  • 1
    It is not a discussion. There should be a reason why it isn't implemented in any languages I know. It shouldn't be a coincidence that all those languages creators have the same opinion of omitting it.
    – AVAVT
    Commented Feb 23, 2019 at 4:26
  • Since there is likely not to be a single answer which applies to all languages and their creators, and we must conjecture the reasons for this, I think it does count as s discussion. Commented Feb 23, 2019 at 18:53
  • Theres no such thing as common sense. Commented Feb 24, 2019 at 3:47
  • Because determining where sentence boundaries fall is deceptively difficult. Try writing a sentence boundary detector, and you'll have a hard time getting anywhere near 100%. Therefore it would take far too much code for a peripheral utility routine in the standard library, Commented Feb 25, 2019 at 7:20

1 Answer 1


That's called sentence case, and there are some challenges with it:

  • The word "I" needs to be capitalized, wherever it appears in the sentence. Granted, the programming language could detect that.
  • Proper nouns ('names') always need to be capitalized. These are a lot harder to detect programmatically; a dictionary alone won't even help since "Mark" is both a name and a common word.
  • A dot does not always signify the end of a sentence, e.g. when using abbreviations like this sentence does.
  • Other languages than English have different capitalization rules: for example, German capitalizes all nouns.

You see that a proper sentence casing tool is much more complicated that just transforming each letter to capital or lowercase form; that's why standard libraries don't have this functionality.

  • Many languages have locale specific utilities for formatting numbers and dates. Seems like the same could be done for basic sentence capitalization.
    – user949300
    Commented Feb 23, 2019 at 21:51
  • 1
    Then you get into Why is quixotic not Quixotic (a proper adjective)? and decide a shot of Tequila sounds good about now.
    – Peter M
    Commented Feb 23, 2019 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.