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. ***
Comment #2 by greensunny12 — 2018-02-10T22:09:57Z
Comment #3 by github-bugzilla — 2018-08-15T15:06:44Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/dca849389f5e293a3ec59444060d317dc1de1316 Fix Issue 12335 - std.algorithm.skipOver should support multiple args like startsWith https://github.com/dlang/phobos/commit/1e3272746aaa574c84eb84cfc9b1cccd575b0f3a Merge pull request #6143 from wilzbach/skipOver Fix Issue 12335 - std.algorithm.skipOver should support multiple args like startsWith merged-on-behalf-of: Sebastian Wilzbach <[email protected]>