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.

cutScalar

Returns slice of haystack before and after first occurrence needle, or null if not found.

See also:

mem.cutScalar
pub fn cutScalar(comptime T: type, haystack: []const T, needle: T) ?struct

File

lib/std/mem.zig:3258

Code

pub fn cutScalar(comptime T: type, haystack: []const T, needle: T) ?struct { []const T, []const T } {
    const index = findScalar(T, haystack, needle) orelse return null;
    return .{ haystack[0..index], haystack[index + 1 ..] };
}