Support.String (Support v0.3.1)
Summary
Functions
Return the remainder of a string after the first occurrence of a given value.
Return the remainder of a string after the last occurrence of a given value.
Get the portion of a string before the first occurrence of a given value.
Get the portion of a string before the last occurrence of a given value.
Get the portion of a string between two given values.
Get the smallest possible portion of a string between two given values.
Convert a string to kebab case.
Convert the first character of the given string to lower-case.
Convert the given string to lower-case.
Get the plural form of an English word.
Reverse the given string.
Get the singular form of an English word.
Convert a string to snake case.
Take the first or last limit
characters of a string.
Convert a string to the specified case.
Convert a string to the specified case with a custom delimiter.
Make a string's first character uppercase.
Convert the given string to upper-case.
Functions
Return the remainder of a string after the first occurrence of a given value.
Usage
iex> alias Support.String
Support.String
iex> String.after("Elixir Package", "Elixir ")
"Package"
Return the remainder of a string after the last occurrence of a given value.
Usage
iex> alias Support.String
Support.String
iex> String.after_last("Elixir Package Elixir", "Elixir ")
"Package Elixir"
Get the portion of a string before the first occurrence of a given value.
Usage
iex> alias Support.String
Support.String
iex> String.before("Elixir Package", " Package")
"Elixir"
Get the portion of a string before the last occurrence of a given value.
Usage
iex> alias Support.String
Support.String
iex> String.before_last("Elixir Package Elixir", " Elixir")
"Elixir Package"
Get the portion of a string between two given values.
Usage
iex> alias Support.String
Support.String
iex> String.between("Elixir Package", "E", "r")
"lixi"
Get the smallest possible portion of a string between two given values.
Usage
iex> alias Support.String
Support.String
iex> String.between_first("Elixir Package", "E", "i")
"l"
Convert a string to kebab case.
Usage
iex> alias Support.String
Support.String
iex> String.kebab("Elixir Package")
"elixir-package"
Convert the first character of the given string to lower-case.
Usage
iex> alias Support.String
Support.String
iex> String.lcfirst("Support")
"support"
Convert the given string to lower-case.
Usage
iex> alias Support.String
Support.String
iex> String.lower("Elixir Package")
"elixir package"
Get the plural form of an English word.
Usage
iex> alias Support.String
Support.String
iex> String.plural("person")
"people"
iex> String.plural("User")
"Users"
Reverse the given string.
Usage
iex> alias Support.String
Support.String
iex> String.reverse("raBooF")
"FooBar"
iex> String.reverse("őtüzsineT")
"Teniszütő"
iex> String.reverse("☆etyBitluM❤")
"❤MultiByte☆"
Get the singular form of an English word.
Usage
iex> alias Support.String
Support.String
iex> String.singular("people")
"person"
iex> String.singular("Users")
"User"
Convert a string to snake case.
Usage
iex> alias Support.String
Support.String
iex> String.snake("Elixir Package")
"elixir_package"
iex> String.snake("Elixir Package", "-")
"elixir-package"
Take the first or last limit
characters of a string.
Usage
iex> alias Support.String
Support.String
iex> String.take("Elixir Package", 7)
"Elixir "
iex> String.take("Elixir Package", -7)
"Package"
Convert a string to the specified case.
Usage
iex> alias Support.String
Support.String
iex> String.to_case("Elixir Package", :kebab)
"elixir-package"
iex> String.to_case("Elixir Package", :snake)
"elixir_package"
iex> String.to_case("Elixir Package", :upper)
"ELIXIR PACKAGE"
iex> String.to_case("Elixir Package", :lower)
"elixir package"
Convert a string to the specified case with a custom delimiter.
Usage
iex> alias Support.String
Support.String
iex> String.to_case("Elixir Package", "_", :snake)
"elixir_package"
iex> String.to_case("Elixir Package", " ?? ", :snake)
"elixir ?? package"
Make a string's first character uppercase.
Usage
iex> alias Support.String
Support.String
iex> String.ucfirst("support")
"Support"
Convert the given string to upper-case.
Usage
iex> alias Support.String
Support.String
iex> String.upper("Elixir Package")
"ELIXIR PACKAGE"