string or random access range of characters
string of leading characters to be stripped
string of trailing characters to be stripped
slice of str stripped of leading and trailing whitespace or characters as specified in the second argument.
assert(strip("xxhelloyy", "x", "y") == "hello"); assert(strip(" xyxyhello worldxyxyzz ", "xy ", "xyz ") == "hello world"); assert(strip("\u2020hello\u2028"w, "\u2020"w, "\u2028"w) == "hello"w); assert(strip("\U00010001hello\U00010002"d, "\U00010001"d, "\U00010002"d) == "hello"d); assert(strip(" hello ", "", "") == " hello ");
assert(strip(" hello world ", "x") == " hello world "); assert(strip(" hello world ", " ") == "hello world"); assert(strip(" xyxyhello worldxyxy ", "xy ") == "hello world"); assert(strip("\u2020hello\u2020"w, "\u2020"w) == "hello"w); assert(strip("\U00010001hello\U00010001"d, "\U00010001"d) == "hello"d); assert(strip(" hello ", "") == " hello ");
Generic stripping on ranges: std.algorithm.mutation._strip
Strips both leading and trailing whitespace (as defined by std.uni.isWhite) or as specified in the second argument.