当前位置:网站首页>BigDecimal removes extra 0 at the end

BigDecimal removes extra 0 at the end

2022-06-10 14:38:00 yechaoa

  • If your data is 9.90, To become 9.9

new BigDecimal(“9.90”).stripTrailingZeros();

  • 9.00 change 9

new BigDecimal(“9.00”).stripTrailingZeros();

At this time, the calculation result will become 4E+1 Or other values

  • therefore , The final formulation should be

new BigDecimal(“9.00”).stripTrailingZeros().toPlainString();

原网站

版权声明
本文为[yechaoa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101411129531.html