Panty v0.1.3 Panty.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> String.camel_case("ha noi")
"haNoi"
iex> String.camel_case("Ha noi")
"haNoi"
iex> String.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> String.keybab_case("ha noi")
"ha-noi"
iex> String.kebab_case("Panty Utilities")
"panty-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> Collection.string_find_index("abcdef", "cde")
2
iex> Collection.string_find_index("{% sections 'header' %}", "{% endschema %}")
nil