by adjusting the range
# codereview
b
by adjusting the range
b
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
ah yes ty