const auto x = "abc";
{
string y = x;
const bool ok = y.findSkip("_");
assert(!ok);
assert(y is x);
}
{
string y = x;
const bool ok = y.findSkip("a");
assert(ok);
assert(y == x[1 .. $]);
}
{
string y = x;
const bool ok = y.findSkip("c");
assert(ok);
assert(y is x[$ .. $]);
}
version (unittest) {
static char[] f()() @safe pure nothrow { char[1] x = "_"; return x[].findSkip(" "); }
static if (hasPreviewDIP1000) static assert(!__traits(compiles, { auto _ = f(); }));
}
const auto x = "abc";
{
string y = x;
const bool ok = y.findSkip('_');
assert(!ok);
assert(y is x);
}
{
string y = x;
const bool ok = y.findSkip('a');
assert(ok);
assert(y == x[1 .. $]);
}
{
string y = x;
const bool ok = y.findSkip('c');
assert(ok);
assert(y is x[$ .. $]);
}
version (unittest) {
static char[] f()() @safe pure nothrow { char[1] x = "_"; return x[].findSkip(' '); }
static if (hasPreviewDIP1000) static assert(!__traits(compiles, { auto _ = f(); }));
}
Array-specialization of findSkip with default predicate.