Search code examples
stringlanguage-agnostic

What's the given name for a String that's capitalized to the first character, lower-cased and trimmed?


When creating a piece of code, I came to the situation in which I had to perform some operations over a String:

  1. Turn it to lower-case
  2. Turn the first character to Capital Case
  3. Remove any trailing or leading whitespace

So that the following happens to the strings:

  • "Foo Bar Baz " -> "Foo bar baz"
  • " bar" -> "Bar"
  • etc.

What is the name of this sort of String? I know we have CAPITALIZEDSTRING, camelCasedString, PascalCasedStringand some others.


Solution

  • According to Wikipedia, you would name it:

    Sentence case:

    "The quick brown fox jumps over the lazy dog"
    

    A mixed-case style in which the first word of the sentence is capitalised, as well as proper nouns and other words as required by a more specific rule.