Dan MacNeil
08/21/2022, 5:27 PMfun main() {
val num = 5.0
val num0 = String.format(Locale.ENGLISH, "%02.0f", num)
val num2 = String.format(Locale.ENGLISH, "%02.2f", num)
println("num0 = $num0, num2 = $num2")
}
This prints: num0 = 05, num2 = 5.00Vampire
08/21/2022, 5:35 PM%05.2f
, as the size is the overall size, not the size before the decimal separator.Dan MacNeil
08/21/2022, 6:49 PM