"CurrencyAmount" (interpreter type)

Amount of money expressed in natural language.

DetailsDetails

Allowed FormsAllowed Forms

  • All the natural-language numbers allowed by "SemanticNumber" are supported for the quantity magnitude.
  • All the natural-language units allowed by "CurrencyName" are supported for the quantity unit.

Restriction SpecificationsRestriction Specifications

  • Restricted["CurrencyAmount",{{choices1,}}]one among choices
    Restricted["CurrencyAmount",unit]convert to unit
    Restricted["CurrencyAmount",unit,max]an amount of money below Quantity[max,unit]
    Restricted["CurrencyAmount",unit,{min,max}]an amount of money between Quantity[min,unit] and Quantity[max,unit]
    Restricted["CurrencyAmount",unit,{min,max,s}]an amount of money between Quantity[min,unit] and Quantity[max,unit] with step s
  • The bounds min and max and step s can also be expressed as quantities.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Interpret currency amounts:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Restrict and convert to a unit:

In[1]:=
Click for copyable input
Out[1]=

If no unit is provided in the input string, imply US dollars:

In[1]:=
Click for copyable input
Out[1]=