skipOverAround

Array-specialization of skipOverBack with default predicate.

See: std.string.chomp

  1. bool skipOverAround(inout(T)[] haystack, T[] needleFront, T[] needleBack)
  2. bool skipOverAround(inout(T)[] haystack, T needleFront, T needleBack)
    @trusted
    bool
    skipOverAround
    (
    T
    )
    (
    scope ref inout(T)[] haystack
    ,
    scope const T needleFront
    ,
    scope const T needleBack
    )
  3. bool startsWith(T[] haystack, T[] needle)
  4. bool startsWith(T[] haystack, T needle)

Examples

string x = "alpha beta_gamma";
assert(x.skipOverAround("alpha", "gamma"));
assert(x == " beta_");
assert(x.skipOverAround(' ', '_'));
assert(x == "beta");
assert(!x.skipOverAround(" ", " "));
assert(x == "beta");
assert(!x.skipOverAround(' ', ' '));
assert(x == "beta");

See Also

Meta