The Money2 package provide a number of methods to create a
- Money.fromInt - from a minorUnit (e.g. cents)
- Money.fromBigInt - from a minorUnit
- Money.parse - parse a monetary string containing an amount.
- Money.fromNum - from a num (int or double) - not recommended
- Currency.parse - parse a monetary string assuming the currency
- Currencies.parse - parse a monetary amount and determine the currency from theembedded currency code.
Moneyvariants all require you to pass in the
Currency or a currency code. The
Currencyvariant requires only the monetary value. The
Currenciesvariant is able to determine the
Currencyif the passed string amount contains a currency code.
The two most common methods are: