Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

trimEnd

Remove a set of values from the end of a slice.

mem.trimEnd
pub fn trimEnd(comptime T: type, slice: []const T, values_to_strip: []const T) []const T

File

lib/std/mem.zig:1202

Code

pub fn trimEnd(comptime T: type, slice: []const T, values_to_strip: []const T) []const T {
    var end: usize = slice.len;
    while (end > 0 and findScalar(T, values_to_strip, slice[end - 1]) != null) : (end -= 1) {}
    return slice[0..end];
}