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

--- Comment #0 from William Moore <> 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:
------- You are receiving this mail because: -------

Reply via email to