Converting String to Money

Viewed 361

I am having the below String

String money = "USD0.00" 

Want to convert this into org.joda.money.Money

Do I need to split the currency unit and double value here and need to set it as separately in Money. Or Any library api is there to convert this?

1 Answers

You can use Money.parse().

From the documentation (emphasis mine)

The string format is '$currencyCode $amount' where there may be zero to many spaces between the two parts.

Related