Fix issue 12890 - index based replace

https://issues.dlang.org/show_bug.cgi?id=12890

EDIT:
I'm going to split this up into two pull request to make review of insert and replace independent (and thus more manageable.)
I'm in the process of reviewing the code, don't pull. It's a PR so it doesn't fall off the radar.
Ah, so my tests were wrong. Where is it documented that the indices are for codeunits and not codepoints?

It's a mess because I thought that it should traverse the ```0..from``` portion only once, instead of twice.