Line to strip the right side of.
Character or string of characters to strip away.
The passed line without any trailing passed characters.
{ immutable trailing = "abc,"; immutable stripped = trailing.strippedRight(','); assert((stripped == "abc"), stripped); } { immutable trailing = "abc!!!"; immutable stripped = trailing.strippedRight('!'); assert((stripped == "abc"), stripped); } { immutable trailing = "abc"; immutable stripped = trailing.strippedRight(' '); assert((stripped == "abc"), stripped); } { immutable trailing = ""; immutable stripped = trailing.strippedRight(' '); assert(!stripped.length, stripped); } { immutable trailing = "abc,!.-"; immutable stripped = trailing.strippedRight("-.!,"); assert((stripped == "abc"), stripped); } { immutable trailing = "abc!!!"; immutable stripped = trailing.strippedRight("!"); assert((stripped == "abc"), stripped); } { immutable trailing = "abc"; immutable stripped = trailing.strippedRight(" ABC"); assert((stripped == "abc"), stripped); } { immutable trailing = ""; immutable stripped = trailing.strippedRight(" "); assert(!stripped.length, stripped); }
Returns a slice of the passed string with any trailing passed characters. Implementation template capable of handling both individual characters and string of tokens to strip.
Duplicates std.string.stripRight, which we can no longer trust not to assert on unexpected input.