recase v0.6.0 Recase.Generic View Source

Generic module to split and join strings back.

This module should not be used directly.

Link to this section Summary

Functions

Splits the input and rejoins it with a separator given. Optionally converts parts to downcase, upcase or titlecase.

Splits the input into list. Utility function.

Link to this section Functions

Link to this function

rejoin(input, opts \\ []) View Source
rejoin(input :: String.t(), opts :: Keyword.t()) :: String.t()

Splits the input and rejoins it with a separator given. Optionally converts parts to downcase, upcase or titlecase.

  • opts[:case] :: [:down | :up | :title | :none]
  • opts[:separator] :: binary() | integer()

Default separator is ?_, default conversion is :downcase so that it behaves the same way as to_snake/1.

Examples

iex> Recase.Generic.rejoin "foo_barBaz-λambdaΛambda-привет-Мир", separator: "__"
"foo__bar__baz__λambda__λambda__привет__мир"
Link to this function

split(input) View Source
split(input :: String.t()) :: [String.t()]

Splits the input into list. Utility function.

Examples

iex> Recase.Generic.split "foo_barBaz-λambdaΛambda-привет-Мир"
["foo", "bar", "Baz", "λambda", "Λambda", "привет", "Мир"]