I tried using padEnd()
twice on a String
. The first time the padEnd()
extension function works as expected, but the second time, it does not add the any characters I tried.
My code:
var s = "Hi -> "
s = s.padEnd(10, 'O')
s = s.padEnd(5, ' ')
println(s)
My output:
Hi -> OOOO
I am using kotlin version 1.2.50. I also tried Jetbrains' online compiler to prevent the bug being only on my computer, with the same result. I also tried using a different version of kotlin (1.0.7 and 1.1.60), with still the same feature/bug.
I also tried using the padStart()
, with the same behaviour, just adding it in front of the String
.
Mixing the two extension functions also did not work as expected: Using padStart()
and immediately after that padEnd()
Is this an expected feature? If so why is it expected? Or is it just a bug?