Combine Words Styles: Camel, Pascal, Snake, Kebab Case
The most popular ways to combine words into a single string:
There are a great number of algorithms for combining words. Here is a few very common ones:
-
flatcase -
kebab-case. Also called:caterpillar-case dash-case hyphen-case lisp-case spinal-case css-case
-
camelCase -
PascalCaseorCapitalCamelCase -
snake_caseorc_case -
UPPER_CASEorMACRO_CASE COBOL-CASEorTRAIN-CASE
The commonly used strategies for combining words are:
camelCasePascalCasesnake_casekebab-case
We’ll go over those here.
Camel Case (camelCase)
Camel case combines words by capitalizing all words following the first word and removing the space, as follows:
Raw: user login count
Camel Case: userLoginCount
This is a very popular way to combine words to form a single concept. It is often used as a convention in variable declaration in many languages.
Pascal Case (PascalCase)
Pascal case combines words by capitalizing all words (even the first word) and removing the space, as follows:
Raw: user login count
Pascal Case: UserLoginCount
This is also a very popular way to combine words to form a single concept. It is often used as a convention in declaring classes in many languages.
Snake Case (snake_case)
Snake case combines words by replacing each space with an underscore (_).
Raw: user login count
Snake Case: user_login_count
It is used conventionally in declaring database field names.
Snake Upper Case (SNAKE_UPPER_CASE)
In the "all caps" version, all letters are capitalized, as follows:
Raw: user login count
Snake Case (All Caps): USER_LOGIN_COUNT
This style is often used as a convention in declaring constants in many languages.
Kebab Case (kebab-case)
Kebab case combines words by replacing each space with a dash (-), as follows:
Raw: user login count
Kebab Case: user-login-count
This style is often used in URLs. For example, www.blog.com/cool-article-1. It is a nice, clean, human-readable way to combine the words.