Panex v0.1.0 Panex.String

String utilities

Link to this section Summary

Functions

Return camel-case from a given string

Return kebab-case from a given string

Get index of a substring from a pattern

Link to this section Functions

Link to this function camel_case(string)
camel_case(String.t()) :: String.t()

Return camel-case from a given string.

Examples

iex> camel_case("ha noi")
"haNoi"
iex> camel_case("Ha noi")
"haNoi"
iex> camel_case("ha-noi")
"haNoi"
Link to this function kebab_case(string)
kebab_case(String.t()) :: String.t()

Return kebab-case from a given string.

Examples

iex> kebab_case("ha noi")
"ha-noi"
iex> kebab_case("Panex Utilities")
"panex-utilities"
Link to this function substring_index(pattern, substring)
substring_index(String.t(), String.t()) :: integer() | nil

Get index of a substring from a pattern.

Examples

iex> substring_index("abcdef", "cde")
2
iex> substring_index("{% sections 'header' %}", "{% endschema %}")
nil