string or forward range of characters
string of characters to be stripped
input stripped of leading whitespace or characters specified in the second argument.
Postconditions: input and the returned value will share the same tail (see std.array.sameTail).
assert(stripLeft(" hello world ", " ") == "hello world "); assert(stripLeft("xxxxxhello world ", "x") == "hello world "); assert(stripLeft("xxxyy hello world ", "xy ") == "hello world ");
import std.array : array; import std.utf : byChar, byWchar, byDchar; assert(stripLeft(" xxxyy hello world "w.byChar, "xy ").array == "hello world "); assert(stripLeft("\u2028\u2020hello world\u2028"w.byWchar, "\u2028").array == "\u2020hello world\u2028"); assert(stripLeft("\U00010001hello world"w.byWchar, " ").array == "\U00010001hello world"w); assert(stripLeft("\U00010001 xyhello world"d.byDchar, "\U00010001 xy").array == "hello world"d); assert(stripLeft("\u2020hello"w, "\u2020"w) == "hello"w); assert(stripLeft("\U00010001hello"d, "\U00010001"d) == "hello"d); assert(stripLeft(" hello ", "") == " hello ");
Generic stripping on ranges: std.algorithm.mutation._stripLeft
Strips leading whitespace (as defined by std.uni.isWhite) or as specified in the second argument.