我是Kotlin 的新人.我确实搜索并阅读了文档,但无法找出在Kotlin for currency中使用的最佳数据类型.在Java中有BigDecimal.Kotlin 也有类似的情况吗?提前谢谢.
我是Kotlin 的新人.我确实搜索并阅读了文档,但无法找出在Kotlin for currency中使用的最佳数据类型.在Java中有BigDecimal.Kotlin 也有类似的情况吗?提前谢谢.
你在Kotlin 也可以用BigDecimal.
var num1 : BigDecimal? = BigDecimal.ZERO
var num2 = BigDecimal("67.9")
Also you can use Double data type and then you can use toBigDecimal() for convert it to BigDecimal.
For the more details :- https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/to-big-decimal.html