[Issue 12335] New: std.algorithm.skipOver should support multiple args like startsWith

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 10 01:20:08 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12335

           Summary: std.algorithm.skipOver should support multiple args
                    like startsWith
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: peter.alexander.au at gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2014-03-10 01:20:03 PDT ---
e.g.

string s = "fooey";
assert(skipOver(s, "foo", "bar") == 1 && s == "ey");
s = "fooey";
assert(skipOver(s, "bar", "foo") == 2 && s == "ey");
s = "fooey";
assert(skipOver(s, "far", "for") == 0 && s == "fooey");

If there are multiple overlapping matches, I think it should match the longest
one as that preserves the most information, and makes it useful in maximal
munch parsers. e.g.

string s = "fooey";
assert(skipOver(s, "foo", "fo") == 1);

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list