How to combine Strings with the different Case style. Different languages prefer different naming conventions and different letter case styles.

Case Types

There are four types of case style we used to combine string:

  • camelCase
  • PascalCase
  • snake_case
  • kebab-case

1) Camel Case (camelCase):

The name refers to the internal capital letters, which resemble the humps on a camel’s back.

camelCase

In camelCase, the first character of string converted into lower case and other characters after space will be converted into upper case character.

Example:

camelCase
myLaptop

2) Pascal Case (PascalCase):

Pascal case combines words by capitalizing all words (even the first word) and removing the space. This is similar to camel case but the first letter is in uppercase

Example:

PascalCase
MyName

3) Snake Case (snake_case):

snake_case

Snake case combines words by replacing each space with an underscore (_) The first letter is either upper or lowercase. It is commonly used in declaring variable names, function names.

Example:

Hello_World
my_file

4) Kebab Case (kebab-case):

kebab-case

Kebab case combines words by replacing each space with a dash (-). All letters are written in lower case and the words are separated by a hyphen or minus sign. The kebab notation is often used as a convention for naming filenames.

Example:

kebab-case
new-file

Thanks for reading!!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store