parseCurrency

Returns an amount that is equal to the given currency amount in text. Examples of what is supported:

  • 12 USD

  • 14.50 USD

  • 10 USD

  • 30 CHF

  • $10.24

  • £13

  • €5000

Note this method does NOT respect internationalisation rules: it ignores commas and uses . as the decimal point separator, always. It also ignores the users locale:

  • $ is always USD,

  • £ is always GBP

  • € is always the Euro

  • ¥ is always Japanese Yen.

  • ₽ is always the Russian ruble.

Thus an input of $12 expecting some other countries dollar will not work. Do your own parsing if you need correct handling of currency amounts with locale-sensitive handling.

Throws

if the input string was not understood.