Cldr.Number.Parser.resolve_per
You're seeing just the function
resolve_per
, go back to Cldr.Number.Parser module for more information.
Specs
resolve_per(String.t(), Keyword.t()) :: per() | [per() | String.t()] | {:error, {module(), String.t()}}
Resolve and tokenize percent or permille from the beginning and/or the end of a string
Arguments
list
is any list in which percent and permille symbols are expectedoptions
is a keyword list of options
Options
:backend
is any module() that includesuse Cldr
and therefore is aCldr
backend module(). The default isCldr.default_backend!/0
:locale
is any valid locale returned byCldr.known_locale_names/1
or aCldr.LanguageTag
struct returned byCldr.Locale.new!/2
The default isoptions[:backend].get_locale()
Returns
An
:percent
orpermille
or{:error, {exception, message}}
Examples
iex> Cldr.Number.Parser.resolve_per "11%"
["11", :percent]
iex> Cldr.Number.Parser.resolve_per "% of linguists"
[:percent, " of linguists"]
iex> Cldr.Number.Parser.resolve_per "% of linguists %"
[:percent, " of linguists ", :percent]