ExDash v0.3.0 Exdash.String

Specialized functions to manipulate Strings.

Summary

Functions

Converts str to camel case

Converts the first character of string to down case

Converts str to kebab case

Converts str to snake case

Convers the first charachter of string to upper case

Split str into words using pattern

Functions

camel_case(str)

Converts str to camel case

Examples

iex> Exdash.String.camel_case("camel case")
"camelCase"

iex> Exdash.String.camel_case("CAMEL CASE")
"CAMELCase"

iex> Exdash.String.camel_case("__camel__case__")
"camelCase"
downcase_first(str)

Converts the first character of string to down case.

Examples

iex> Exdash.String.downcase_first("HELLO WORLD")
"hELLO WORLD"
kebab_case(str)

Converts str to kebab case

Examples

iex> Exdash.String.kebab_case("kebab case")
"kebab-case"

iex> Exdash.String.kebab_case("kebab_case")
"kebab-case"

iex> Exdash.String.kebab_case("Kebab-Case")
"kebab-case"
snake_case(str)

Converts str to snake case

Examples

iex> Exdash.String.snake_case("foo bar")
"foo_bar"

iex> Exdash.String.snake_case("__FOO__BAR__")
"foo_bar"
upcase_first(str)

Convers the first charachter of string to upper case.

Examples

iex> Exdash.String.upcase_first("hello world")
"Hello world"
words(str, pattern \\ ~r"\\s")

Split str into words using pattern.

Examples

iex> Exdash.String.words("foo bar baz")
["foo", "bar", "baz"]

iex> Exdash.String.words("foo_bar_baz", ~r"_")
["foo", "bar", "baz"]