MyApp.Cldr.List.to_string

You're seeing just the function to_string, go back to MyApp.Cldr.List module for more information.
Link to this function

to_string(list, options \\ [])

View Source

Specs

to_string([term()], Keyword.t()) ::
  {:ok, String.t()} | {:error, {module(), String.t()}}

Formats a list into a string according to the list pattern rules for a locale.

Arguments

  • list is any list of of terms that can be passed through Kernel.to_string/1

  • options is a keyword list

Options

Examples

iex> MyApp.Cldr.List.to_string(["a", "b", "c"], locale: "en")
{:ok, "a, b, and c"}

iex> MyApp.Cldr.List.to_string(["a", "b", "c"], locale: "en", format: :unit_narrow)
{:ok, "a b c"}

iex> MyApp.Cldr.List.to_string(["a", "b", "c"], locale: "fr")
{:ok, "a, b et c"}

iex> MyApp.Cldr.List.to_string([1,2,3,4,5,6])
{:ok, "1, 2, 3, 4, 5, and 6"}

iex> MyApp.Cldr.List.to_string(["a"])
{:ok, "a"}

iex> MyApp.Cldr.List.to_string([1,2])
{:ok, "1 and 2"}