skipOver

Array-specialization of skipOver with default predicate.

  1. bool skipOver(inout(T)[] haystack, T[] needle)
  2. bool skipOver(inout(T)[] haystack, T needle)
    @trusted
    bool
    skipOver
    (
    T
    )
    (
    scope ref inout(T)[] haystack
    ,
    scope const T needle
    )

Examples

string x = "beta version";
assert(x.skipOver("beta"));
assert(x == " version");
assert(x.skipOver(' '));
assert(x == "version");

constness of haystack and needle

1 {
2     const(char)[] haystack;
3     string needle;
4     assert(haystack.skipOver(needle));
5 }
6 {
7     const(char)[] haystack;
8     const(char)[] needle;
9     assert(haystack.skipOver(needle));
10 }
11 {
12     const(char)[] haystack;
13     char[] needle;
14     assert(haystack.skipOver(needle));
15 }

See Also

Meta