stripRight

Strips trailing whitespace (as defined by std.uni.isWhite) or as specified in the second argument.

  1. auto stripRight(Range str)
  2. auto stripRight(Range str, const(Char)[] chars)
    stripRight
    (
    Range
    Char
    )
    (
    Range str
    ,
    const(Char)[] chars
    )

Parameters

str Range

string or random access range of characters

chars const(Char)[]

string of characters to be stripped

Return Value

Type: auto

slice of str stripped of trailing whitespace or characters specified in the second argument.

Examples

assert(stripRight("     hello world     ", "x") ==
       "     hello world     ");
assert(stripRight("     hello world     ", " ") ==
       "     hello world");
assert(stripRight("     hello worldxy     ", "xy ") ==
       "     hello world");

See Also

Generic stripping on ranges: std.algorithm.mutation._stripRight

Meta