Leonid Volnitsky: > Thanks for bug report! Code is very new.
You are welcome :-) > Bug manifests itself when substring is in 0 position. > Fix: I may not understand the purpose of the function, but after your fix this code: void main() { string s1 = "hello, how are you? I'm well, thanks"; writeln(s1.length); string s2 = "wello"; auto ptr = volnitsky(s1, s2); writeln(ptr - s1.ptr); writeln(s1[ptr - s1.ptr .. $]); } Prints: 36 24 well, thanks But "wello" is not present in the s1 string, so returning 24 is not what I desire... Bye, bearophile