| ... | ... | @@ -941,21 +941,21 @@ pub fn allEqual(comptime T: type, slice: []const T, scalar: T) bool { |
| 941 | 941 | return true; |
| 942 | 942 | } |
| 943 | 943 | |
| 944 | | /// Remove values from the beginning of a slice. |
| 944 | /// Remove a set of values from the beginning of a slice. |
| 945 | 945 | pub fn trimLeft(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { |
| 946 | 946 | var begin: usize = 0; |
| 947 | 947 | while (begin < slice.len and indexOfScalar(T, values_to_strip, slice[begin]) != null) : (begin += 1) {} |
| 948 | 948 | return slice[begin..]; |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | | /// Remove values from the end of a slice. |
| 951 | /// Remove a set of values from the end of a slice. |
| 952 | 952 | pub fn trimRight(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { |
| 953 | 953 | var end: usize = slice.len; |
| 954 | 954 | while (end > 0 and indexOfScalar(T, values_to_strip, slice[end - 1]) != null) : (end -= 1) {} |
| 955 | 955 | return slice[0..end]; |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | | /// Remove values from the beginning and end of a slice. |
| 958 | /// Remove a set of values from the beginning and end of a slice. |
| 959 | 959 | pub fn trim(comptime T: type, slice: []const T, values_to_strip: []const T) []const T { |
| 960 | 960 | var begin: usize = 0; |
| 961 | 961 | var end: usize = slice.len; |