Crate casbab

source ·
Expand description

Camel Snake Kebab

Package casbab is a rust library for converting representation style of compound words or phrases. Different writing styles of compound words are used for different purposes in computer code and variables to easily distinguish type, properties or meaning.

Functions in this package are separating words from input string and constructing an appropriate phrase representation.

Examples:

  • kebab("camel_snake_kebab") returns camel-snake-kebab
  • screaming_snake("camel_snake_kebab") returns CAMEL_SNAKE_KEBAB
  • camel("camel_snake_kebab") returns camelSnakeKebab
  • pascal("camel_snake_kebab") returns CamelSnakeKebab
  • snake("camelSNAKEKebab") returns camel_snake_kebab

Word separation works by detecting delimiters hyphen (-), underscore (_), space ( ) and letter case change.

Note: Leading and trailing separators will be preserved only within the Snake family or within the Kebab family and not across them. This restriction is based on different semantics between different writings.

Examples:

  • camel_snake("__camel_snake_kebab__") returns __Camel_Snake_Kebab__
  • kebab("__camel_snake_kebab") returns camel-snake-kebab
  • screaming("__camel_snake_kebab") returns CAMEL SNAKE KEBAB
  • camel_kebab("--camel-snake-kebab") returns --Camel-Snake-Kebab
  • snake("--camel-snake-kebab") returns camel_snake_kebab
  • screaming("--camel-snake-kebab") returns CAMEL SNAKE KEBAB

Functions

  • Camel case is the practice of writing compound words or phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no spaces or hyphens.
  • Camel kebab case is a variant of Kebab case with each element’s first letter uppercased.
  • Camel snake case is a variant of Camel case with each element’s first letter uppercased.
  • Kebab case is the practice of writing compound words or phrases in which the elements are separated with one hyphen character (-) and no spaces, with all element letters lowercased within the compound.
  • Lower is returning detected words, not in a compound form, but separated by one space character with all letters in lower case.
  • Pascal case is a variant of Camel case writing where the first letter of the first word is always capitalized.
  • Screaming is returning detected words, not in a compound form, but separated by one space character with all letters in upper case.
  • Screaming kebab case is a variant of Kebab case with all letters uppercased.
  • Screaming snake case is a variant of Camel case with all letters uppercased.
  • Snake case is the practice of writing compound words or phrases in which the elements are separated with one underscore character (_) and no spaces, with all element letters lowercased within the compound.
  • Title is returning detected words, not in a compound form, but separated by one space character with first character in all letters in upper case and all other letters in lower case.