ExDash v0.3.1 Exdash.String

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)

Specs

camel_case(String.t) :: String.t

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)

Specs

downcase_first(String.t) :: String.t

Converts the first character of string to down case.

Examples

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

Specs

kebab_case(String.t) :: String.t

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)

Specs

snake_case(String.t) :: String.t

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)

Specs

upcase_first(String.t) :: String.t

Convers the first charachter of string to upper case.

Examples

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

Specs

words(String.t, Regex.t) :: list

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"]