Line to strip the right side of.
The passed line without any trailing whitespace or linebreaks.
static if (!is(typeof("blah".strippedRight) == string)) { enum message = "`lu.string.strippedRight` should return a mutable string"; static assert(0, message); } { immutable trailing = "abc "; immutable stripped = trailing.strippedRight; assert((stripped == "abc"), stripped); } { immutable trailing = " "; immutable stripped = trailing.strippedRight; assert((stripped == ""), stripped); } { immutable empty = ""; immutable stripped = empty.strippedRight; assert((stripped == ""), stripped); } { immutable noTrailing = "abc"; immutable stripped = noTrailing.strippedRight; assert((stripped == "abc"), stripped); } { immutable linebreak = "abc\r\n \r\n"; immutable stripped = linebreak.strippedRight; assert((stripped == "abc"), stripped); }
Returns a slice of the passed string with any trailing whitespace and/or linebreaks sliced off. Overload that implicitly strips " \n\r\t".
Duplicates std.string.stripRight, which we can no longer trust not to assert on unexpected input.