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");
https://forum.dlang.org/post/dhxwgtaubzbmjaqjmnmq@forum.dlang.org
Array-specialization of skipOverBack with default predicate.
See: std.string.chomp