Well, this is an interesting issue. While obviously it should not crash, I somehow doubt that returning -1 is correct here.
More specifically, I believe that
String h("xxx");
h.Find("");
should return 0, because there IS empty substring at position 0 after all. In any case, such behaviour is consistent with e.g. STL (and I suspect all other libraries).
CONSOLE_APP_MAIN {
std::string s = "xxxxxx";
DDUMP(s.find(""));
}
Means, specifying empty string as string to be replaced is sort of illegal. Anyway, I have added a check to Replace. Thanks for pointing that out...