import std.algorithm.comparison : equal; import nxt.array_help : s; assert(``.splitterASCIIAmong!(' ') .empty); assert(` `.splitterASCIIAmong!(' ') .empty); assert(` `.splitterASCIIAmong!(' ') .empty); assert(` - `.splitterASCIIAmong!(' ') .equal([`-`].s[])); assert(`a`.splitterASCIIAmong!(' ') .equal([`a`].s[])); assert(` a `.splitterASCIIAmong!(' ') .equal([`a`].s[])); assert(` a b `.splitterASCIIAmong!(' ') .equal([`a`, `b`].s[])); assert(` a_b `.splitterASCIIAmong!(' ') .equal([`a_b`].s[])); assert(` - aa bb--c-d--e`.splitterASCIIAmong!(' ', '-') .equal([`aa`, `bb`, `c`, `d`, `e`].s[])); assert(` - aa bb--c-_d--_e`.splitterASCIIAmong!(' ', '-', '_') .equal([`aa`, `bb`, `c`, `d`, `e`].s[])); assert(` - aa /// bb--c-_d--_e`.splitterASCIIAmong!(' ', '-', '_', '/') .equal([`aa`, `bb`, `c`, `d`, `e`].s[]));
Non-decoding ASCII-separator-only variant of Phobos' splitter that .
TODO: generalize to separators being either chars or strings.