www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: peter.alexander.au gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au 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: -------
Mar 10 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12335


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com


--- Comment #1 from Andrei Alexandrescu <andrei erdani.com> 2014-03-13 18:38:46
PDT ---
*** Issue 12336 has been marked as a duplicate of this issue. ***

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