Bug 12335 – std.algorithm.skipOver should support multiple args like startsWith
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-10T01:20:03Z
Last change time
2018-08-15T15:06:45Z
Assigned to
No Owner
Creator
Peter Alexander
Comments
Comment #0 by peter.alexander.au — 2014-03-10T01:20:03Z
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);
Comment #1 by andrei — 2014-03-13T18:38:46Z
*** Issue 12336 has been marked as a duplicate of this issue. ***