assert("beta".strip(' ') == "beta"); assert(" beta ".strip(' ') == "beta"); assert(" beta ".strip(' ') == "beta"); assert(" beta ".strip(' ') == "beta"); assert(" _ beta _ ".strip(' ') == "_ beta _"); assert(" _ beta _ ".strip(' ') == "_ beta _"); version (unittest) { static char[] f()() @safe pure nothrow { char[1] x = "_"; return x[].strip(' '); } static if (hasPreviewDIP1000) static assert(!__traits(compiles, { auto _ = f(); })); }
const ubyte[3] x = [0, 42, 0]; assert(x.strip(0) == x[1 .. 2]);
https://forum.dlang.org/post/dhxwgtaubzbmjaqjmnmq@forum.dlang.org
Array-specialization of strip with default predicate.