Bug with std.string.indexOf and case sensivity

Alexandre L. via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 16 16:52:50 PDT 2014


Hello,
I was playing around with indexOf when I noticed that the 
parameter CaseSensitive seems to have a weird behavior.

Let's say the following code:

string str = "Les chemises sont sèches";

write(std.string.indexOf(str, "Les")); // Returns 0, as expected
write(std.string.indexOf(str, "les", CaseSensitive.no)); // 
Returns -1 while it should return 0
write(std.string.indexOf(str, "Les", CaseSensitive.yes)); // 
Returns -1 while it should return 0

I'm using DMD 2.065 and if I am not mistaken, I think it was 
working fine with DMD 2.064. Or is it that I do not understand 
what CaseSensitive really do?

Alexandre L.


More information about the Digitalmars-d-learn mailing list