pub fn cut(comptime T: type, haystack: []const T, needle: []const T) ?struct T: typehaystack: []const Tneedle: []const T3255
3256
3257
3258pub fn cut(comptime T: type, haystack: []const T, needle: []const T) ?struct { []const T, []const T } {
const index = find(T, haystack, needle) orelse return null;
return .{ haystack[0..index], haystack[index + needle.len ..] };
}
Returns slice of
haystackbefore and after first occurrence ofneedle, ornullif not found.See also:
cutScalarsplittokenizeAny