std.array.replaceFirst didn't work with variable length strings

* also added doc unittest

moved import into static ifs
Merge pull request #2703 from burner/std_array_replaceFirst_utf_fix

std.array.replaceFirst didn't work with variable length strings