Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 data = 137500 作为双变量,我用 DecimalFormat 转换为 Rp.137.500,00 并设置为文本字段。我如何从 texfield 重新格式化为 137500。cz 我想从中相乘。
你的double变量还在范围内吗?
double
如果是 - 只需使用它。
如果没有,请更改它的可见性和/或创建get...()访问它的方法。
get...()
以适当的数字类型输入数字并在必要时进行格式化总是一个好主意。
虽然应该可以提取仅包含数字部分的子字符串,然后使用Double.parseDouble()方法进行转换,但我仍然没有看到这样做的意义。
Double.parseDouble()