1233 – std.string.ifind(char[] s, char[] sub) fails on certain non ascii strings

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1233 - std.string.ifind(char[] s, char[] sub) fails on certain non ascii strings
Summary: std.string.ifind(char[] s, char[] sub) fails on certain non ascii strings
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 trivial
Assignee: Walter Bright
URL:
Keywords: patch
Depends on:
Blocks:
Reported: 2007年05月15日 17:51 UTC by Charles Gordon
Modified: 2015年06月09日 05:15 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Charles Gordon 2007年05月15日 17:51:03 UTC
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.
Comment 1 Walter Bright 2007年07月01日 14:02:59 UTC
Fixed DMD 1.018 and DMD 2.002


AltStyle によって変換されたページ (->オリジナル) /