https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

Robert

02/05/2019, 9:40 PM
Is it possible to implement a method
insert
(or
prepend
) to the
StringBuilder
class? There already is
append
o

olonho

02/06/2019, 7:43 AM
it will not be very efficient, builder leaves free space after last inserted character. Better use MutableList to store all prefixes and build final sting passing this list in backward direction.
r

Robert

02/06/2019, 6:00 PM
That sounds quite cumbersome. Idk if inefficient performance is a good argument to leave out functional features, but at least I got an answer why it is being left out. JVM and Native do have an implementation though, so I would think it is possible....