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

* improved the unittest some
* also added a doc unittest
Move imports into `static if` for strings.