[Issue 3704] New: split(char[], char[]) is broken for delimiters greater than a single character
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 13 21:49:08 PST 2010
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 at puremagic.com
ReportedBy: nyphbl8d at gmail.com
--- Comment #0 from William Moore <nyphbl8d at gmail.com> 2010-01-13 21:49:06 PST ---
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: -------
More information about the Digitalmars-d-bugs
mailing list