[Issue 1233] New: std.string.ifind(char[] s, char[] sub) fails on certain non ascii strings
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 15 15:51:04 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1233
Summary: std.string.ifind(char[] s, char[] sub) fails on certain
non ascii strings
Product: D
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Keywords: patch
Severity: trivial
Priority: P2
Component: Phobos
AssignedTo: bugzilla at digitalmars.com
ReportedBy: d at chqrlie.org
import std.string;
int main(char[][] args) {
printf("ifind(\"é\", \"é\") -> %d\n", ifind("é", "é"));
return 0;
}
produces incorrect output :
ifind("é", "é") -> -1
bug is in src/phobos/std/string.d, line 613:
- size_t imax = s.length - sublength;
+ size_t imax = s.length - sublength + 1;
This will fix the bug, but the implementation will remain quite inefficient.
--
More information about the Digitalmars-d-bugs
mailing list