Kase.Conversor (kase v1.1.2)

A module for converting strings between different casing styles.

Summary

Functions

Converts a given string to the specified target_case.

Functions

Link to this function

convert(string, target_case)

@spec convert(String.t() | map(), Kase.target_case()) :: String.t()

Converts a given string to the specified target_case.

Examples

iex> Kase.convert("THIS-IS-COBOL-CASE", :humanized_case)
"This is cobol case"

iex> Kase.convert("this-variable-name", :camel_case)
"thisVariableName"

iex> Kase.convert("ThisIsPascalCase", :snake_case)
"this_is_pascal_case"

iex> Kase.convert("snake_case_var", :kebab_case)
"snake-case-var"

iex> Kase.convert("PascalCaseVar", :upper_case_snake_case)
"PASCAL_CASE_VAR"

iex> Kase.convert("this-is-an-example", :train_case)
"This-Is-An-Example"

iex> Kase.convert("this_is_cobol_case", :cobol_case)
"THIS-IS-COBOL-CASE"

iex> Kase.convert("exampleForDotCase", :dot_case)
"example.for.dot.case"

iex> Kase.convert("example.for.flat.case", :flat_case)
"exampleforflatcase"

Supported target cases

  • :camel_case
  • :cobol_case
  • :dot_case
  • :flat_case
  • :humanized_case
  • :kebab_case
  • :pascal_case
  • :snake_case
  • :train_case
  • :upper_case_snake_case
Link to this function

from_dot_case_to_flat_case(string)

@spec from_dot_case_to_flat_case(String.t()) :: String.t()