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.

splitBackwardsScalar

Returns an iterator that iterates backwards over the slices of buffer that are separated by delimiter.

splitBackwardsScalar(u8, "abc|def||ghi", '|') will return slices for "ghi", "", "def", "abc", null, in that order.

If delimiter does not exist in buffer, the iterator will return buffer, null, in that order.

See also: splitBackwardsSequence, splitBackwardsAny, splitSequence, splitAny,splitScalar, tokenizeAny, tokenizeSequence, and tokenizeScalar.

mem.splitBackwardsScalar
pub fn splitBackwardsScalar(comptime T: type, buffer: []const T, delimiter: T) SplitBackwardsIterator(T, .scalar)

File

lib/std/mem.zig:2832

Code

pub fn splitBackwardsScalar(comptime T: type, buffer: []const T, delimiter: T) SplitBackwardsIterator(T, .scalar) {
    return .{
        .index = buffer.len,
        .buffer = buffer,
        .delimiter = delimiter,
    };
}