digitalmars.D.bugs - [Issue 3704] New: split(char[],char[]) is broken for delimiters greater than a single character
- d-bugmail puremagic.com (33/33) Jan 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=3704
- d-bugmail puremagic.com (21/21) May 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3704
- d-bugmail puremagic.com (11/11) May 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=3704
http://d.puremagic.com/issues/show_bug.cgi?id=3704 Summary: split(char[],char[]) is broken for delimiters greater than a single character Product: D Version: 1.054 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: nyphbl8d gmail.com --- There are no fewer than 4 critical errors in the latest implementation of split in phobos for the code path that deals with delimiters of length > 1. test code: import std.stdio; import std.string; void main() { foreach(item;" match".split(" and ")) writefln("my data: %s",item); } Half of the problem is caused by using size_t (which is unsigned afaict) to capture the return value of find, which can be negative. This issue causes the following comparison to fail: if (j == -1) The other half is caused by not accounting for the fact that i can be greater than s.length, as well as equal. This causes the following comparison to fail to perform as expected: if (i == s.length) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3704 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 21:34:17 PDT --- Has this been fixed? I have no problem of using delimiters with sizes greater than 1: This works: import std.stdio; import std.string; void main() { foreach (item; "test test".split(" ")) { writefln("my data: %s", item); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3704 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc If this bug report doesn't become more clear, then I suggest to eventually close it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 25 2011