Function indexOfNonePos [src]
Find the first item in slice[start_index..] which is not contained in values.
The returned index will be relative to the start of slice, and never less than start_index.
Comparable to strspn in the C standard library.
Prototype
pub fn indexOfNonePos(comptime T: type, slice: []const T, start_index: usize, values: []const T) ?usize
Parameters
T: type
slice: []const T
start_index: usize
values: []const T
Source
pub fn indexOfNonePos(comptime T: type, slice: []const T, start_index: usize, values: []const T) ?usize {
if (start_index >= slice.len) return null;
outer: for (slice[start_index..], start_index..) |c, i| {
for (values) |value| {
if (c == value) continue :outer;
}
return i;
}
return null;
}