https://kotlinlang.org logo
#codereview
Title
# codereview
b

Brian Carbone

12/04/2019, 6:54 PM
by adjusting the range
b

Burkhard

12/04/2019, 7:04 PM
You could use
StringBuilder
instead.
Copy code
val sb = StringBuilder()
sb.add(orig.substring(0, rng0.start)
sb.add(repl[0])
sb.add(orig.substring(rng0.end + 1, rng1.start)
// etc
Just check my ranges, I might have a few off by one errors in there. I don’t remember when start/end are inclusive or exclusive. Also the ranges can’t overlap but you can just modify them
b

Brian Carbone

12/04/2019, 8:24 PM
ah yes ty
7 Views