Cldr.Number.Parser.scan
You're seeing just the function
scan, go back to Cldr.Number.Parser module for more information.
Specs
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.
Arguments
stringis anyString.toptionsis a keyword list of options
Options
:numberis one of:integer,:float,:decimalornil. The default isnilmeaning that the type auto-detected as either anintegeror afloat.:backendis any module that includesuse Cldrand is therefore a CLDR backend module. The default isCldr.default_backend!/0.:localeis any locale returned byCldr.known_locale_names/1or at:Cldr.LanguageTag. The default isoptions[:backend].get_locale/1.
Returns
- A list of strings and numbers
Notes
Number parsing is performed by Cldr.Number.Parser.parse/2
and any options provided are passed to that function.
Examples
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]