Hi there, how do I get to make `10_000_000_000.0.t...
# announcements
a
Hi there, how do I get to make
10_000_000_000.0.toString()
to display as
10000000000.0
insted of
1.0E10
?
m
println(String.format("%.1f", 10_000_000_000.0))
you can control how many digits it prints after
.
by changing the number in
%.1f
(%.2f will print 2 decimal places)
a
is
String.format
available in
stdlib-common
? IDEA can't seem to resolve it
n
it's a part of the JDK
a
Is there a multiplatfrom alternative? Not only JDK?
n
not sure.
m
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/format.html this says that it’s available in common, native, jvm and js
a
Thanks. The link you posted shows that it is only available in JVM.
expect/actual
here I come
m
ah right sorry
e
You can either start with an integer value:
10_000_000_000.toString()
or convert your floating-point value to an integer:
Copy code
10_000_000_000.0.toLong().toString()
a
I am even laughing at myself right now
Thank you Roman