replaceLast and some replaceFirst fixes

While testing of replaceFirst with utf8 string I found a bug and fixed that.
This lead me to add replaceLast because I needed such a function in the past and didn't want to retro four times.

This also adds doc unittests to both
This looks wrong, it will fail with narrow strings because `countUntil` is not the same as `indexOf` in that case.