Function trimLeft [src]
Alias for std.mem.trimStart
Remove a set of values from the beginning of a slice.
Prototype
pub fn trimStart(comptime T: type, slice: []const T, values_to_strip: []const T) []const T
Parameters
T: type
slice: []const T
values_to_strip: []const T
Example
test trimStart {
try testing.expectEqualSlices(u8, "foo\n ", trimStart(u8, " foo\n ", " \n"));
}
Source
pub fn trimStart(comptime T: type, slice: []const T, values_to_strip: []const T) []const T {
var begin: usize = 0;
while (begin < slice.len and indexOfScalar(T, values_to_strip, slice[begin]) != null) : (begin += 1) {}
return slice[begin..];
}