You're seeing just the function scan, go back to Cldr.Number.Parser module for more information.
Link to this function

scan(string, options \\ [])

View Source


scan(String.t(), Keyword.t()) ::
  [String.t() | integer() | float() | Decimal.t()]
  | {:error, {module(), String.t()}}

Scans a string in a locale-aware manner and returns a list of strings and numbers.


  • string is any String.t

  • options is a keyword list of options


  • :number is one of :integer, :float, :decimal or nil. The default is nil meaning that the type auto-detected as either an integer or a float.

  • :backend is any module that includes use Cldr and is therefore a CLDR backend module. The default is Cldr.default_backend!/0.

  • :locale is any locale returned by Cldr.known_locale_names/1 or a t:Cldr.LanguageTag. The default is options[:backend].get_locale/1.


  • A list of strings and numbers


Number parsing is performed by Cldr.Number.Parser.parse/2 and any options provided are passed to that function.


iex> Cldr.Number.Parser.scan("£1_000_000.34")
["£", 1000000.34]

iex> Cldr.Number.Parser.scan("I want £1_000_000 dollars")
["I want £", 1000000, " dollars"]

iex> Cldr.Number.Parser.scan("The prize is 23")
["The prize is ", 23]

iex> Cldr.Number.Parser.scan("The lottery number is 23 for the next draw")
["The lottery number is ", 23, " for the next draw"]

iex> Cldr.Number.Parser.scan("The loss is -1.000 euros", locale: "de", number: :integer)
["The loss is ", -1000, " euros"]

iex> Cldr.Number.Parser.scan "1kg"
[1, "kg"]

iex> Cldr.Number.Parser.scan "A number is the arab script ١٢٣٤٥", locale: "ar"
["A number is the arab script ", 12345]