V
V
Vanes Ri_Lax2021-09-10 15:12:39
Kotlin
Vanes Ri_Lax, 2021-09-10 15:12:39

How to format an integer in Kotlin?

Good afternoon!
I have this code
var str: String = "%,d".format(1231)
The output is 1,231
How do I get the output 1231
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VaneS Ri_Lax, 2021-09-10
@vanesxl

Denis Zagaevsky thanks for the answer!
This is how it works for me

var str: String = "%,d".format(Locale("RU"),1234)
println(str)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question