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