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