Kase.Conversor (kase v0.2.0)

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(), atom()) :: 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"