You can use removeSuffix
:
fun main() {
println(100.5.toString().removeSuffix(".0"))
println(100.0.toString().removeSuffix(".0"))
}
Output:
100.5
100
CLICK HERE to find out more related problems solutions.
You can use removeSuffix
:
fun main() {
println(100.5.toString().removeSuffix(".0"))
println(100.0.toString().removeSuffix(".0"))
}
Output:
100.5
100
CLICK HERE to find out more related problems solutions.