Skip to content

Instantly share code, notes, and snippets.

@GeorgeHernandez
Last active June 23, 2023 21:07
Show Gist options
  • Save GeorgeHernandez/61c8315279d73271a2b6d936d1ed013f to your computer and use it in GitHub Desktop.
Save GeorgeHernandez/61c8315279d73271a2b6d936d1ed013f to your computer and use it in GitHub Desktop.
A collection of cases

Case of Cases

This piece is about capitalization and letter case for sets of words. Which capitalization style should be used depends on context. E.g.

My preference is to have the name of the capitalization style also be an example of it.

Vernacular Cases

This first set of capitalization styles is ordered from most to fewest capitals, with words delimited with a space.

Example                           Capitalization Style      Capitalize
======================================================================
THE BOOK AND BOB ARE IN THE CAR   ALL UPPER CASE            all letters
The Book And Bob Are In The Car   All Words Case            all words
The Book and Bob Are in the Car   Title Case                the first and all words with some exceptions †
The Book and Bob are in the Car   German  Sentence case     the first word and all        nouns
The book and Bob are in the car   English sentence case     the first word and all proper nouns
the book and Bob are in the Car   mid Sentence German case                     all        nouns
the book and Bob are in the car   mid sentence English case                    all proper nouns
the book and bob are in the car   all lower case

† The exceptions are usually articles, prepositions, & conjunctions, but it depends on whether you follow the AP Stylebook, the Chicago Manual of Style, the MLA Handbook, APA Style, AMA Style, The Bluebook, or other rules. See Title case.

Programming Cases

This second set of capitalization styles is in ASCII ascending order.

Example     Capitalization Style
================================
tWo wOrDs   cAmEl aLtErNaTiNg sPaCe cAsE
two Words   camel Space Case
two words   lower space case
TwO WoRdS   PaScAl aLtErNaTiNg sPaCe cAsE
Two Words   Pascal Space Case
TWO WORDS   UPPER SPACE CASE, ALL CAPS
two_Words   camel_Snake_Case
two_words   lower_snake_case, snake_case
Two_Words   Pascal_Snake_Case
TWO_WORDS   UPPER_SNAKE_CASE, CONSTANT_CASE
two-Words   camel-KEBAB-CASE
two-words   lower-kebab-case, kebab-case
Two-Words   Pascal-Kebab-Case
TWO-WORDS   UPPER-KEBAB-CASE, COBOL-CASE
tWoWoRdS    cAmElAlTeRnAtInGcAsE
twoWords    camelCase
twowords    lowercase
TwOwOrDs    PaScAlAlTeRnAtInGcAsE
TwoWords    PascalCase
TWOWORDS    UPPERCASE, ALLCAPS

Acronyms get a bit odd. E.g. If you have "XML file", then is it 1 word or 3?

In camelCase:  If 1 then `xmlFile`, but if 3 then `xMLFile`.
In PascalCase: If 1 then `XmlFile`, but if 3 then `XMLFile`.

Other Cases

GermanNounscase becauseGermanscapitalizeNouns
emoji🐱case Delimit🦋words🦋with🦋emojis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment