gpt4 book ai didi

java - 将字符串转换为货币

转载 作者:行者123 更新时间:2023-12-02 02:24:56 25 4
gpt4 key购买 nike

我有以下字符串

String money = "USD0.00" 

想要将其转换为org.joda.money.Money

我是否需要在这里将货币单位和双值分开,并需要在Money中单独设置。或者有任何库 api 可以转换它吗?

最佳答案

您可以使用Money.parse()

来自documentation (强调我的)

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

关于java - 将字符串转换为货币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65825373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com