resolve_currencies, go back to MyApp.Cldr.Number module for more information.
Resolve curencies from strings within a list.
listis any list in which currency names and symbols are expected
optionsis a keyword list of options
atomor list of
atomsrepresenting the currencies or currency types to be considered for a match. The equates to a list of acceptable currencies for parsing. See the notes below for currency types.
atomor list of
atomsrepresenting the currencies or currency types to be not considered for a match. This equates to a list of unacceptable currencies for parsing. See the notes below for currency types.
:fuzzyis a float greater than
0.0and less than or equal to
1.0which is used as input to
String.jaro_distance/2to determine is the provided currency string is close enough to a known currency string for it to identify definitively a currency code. It is recommended to use numbers greater than
0.8in order to reduce false positives.
:except options accept a list of
currency codes and/or currency types. The following
types are recognised.
:except are specified,
:except entries take priority - that means
any entries in
:except are removed from the
:all, the default, considers all currencies
:currentconsiders those currencies that have a
:todate of nil and which also is a known ISO4217 currency
:historicis the opposite of
:tenderconsiders currencies that are legal tender
:unannotatedconsiders currencies that don't have "(some string)" in their names. These are usually financial instruments.
iex> MyApp.Cldr.Number.scan("100 US dollars") ...> |> MyApp.Cldr.Number.resolve_currencies [100, :USD] iex> MyApp.Cldr.Number.scan("100 eurosports") ...> |> MyApp.Cldr.Number.resolve_currencies(fuzzy: 0.75) [100, :EUR] iex> MyApp.Cldr.Number.scan("100 dollars des États-Unis") ...> |> MyApp.Cldr.Number.resolve_currencies(locale: "fr") [100, :USD]