stride(s, i) returns 0xFF, or 255, if s[i] is not a UTF-8 lead byte. This design allows the function to silently succeed when the input is broken: auto str = new char[](300); str[0] = '\xFE'; // broken str = str[str.stride(0) .. $]; // jumps 255 bytes stride(s, i) should throw an exception if s[i] is not a lead byte. Or at least the error value should not be 255.
Are you sure that you understand how stride works? stride returns the length of an UTF sequence, not an index. Why would you try to use the return value of stride as an index?
(In reply to comment #1) > Are you sure that you understand how stride works? stride returns the length of > an UTF sequence, not an index. Why would you try to use the return value of > stride as an index? You use the length to index into the string or to slice it. Obviously stride() should return a valid value, and not some undocumented magic (well it's a bug most likely, and not a feature gone wrong). I don't get what's your problem.
Fixed in changeset 2190. http://dsource.org/projects/phobos/changeset/2190