Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

splitBackwardsSequence

Public Function
std.mem.splitBackwardsSequence
pub fn splitBackwardsSequence(comptime T: type, buffer: []const T, delimiter: []const T) SplitBackwardsIterator(T, .sequence)

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

splitBackwardsSequence(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. The delimiter length must not be zero.

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

Params

  • T: type
  • buffer: []const T
  • delimiter: []const T

File

mem.zig:2825
2825
2826
2827
2828
2829
2830
2831
2832
pub fn splitBackwardsSequence(comptime T: type, buffer: []const T, delimiter: []const T) SplitBackwardsIterator(T, .sequence) {
    assert(delimiter.len != 0);
    return .{
        .index = buffer.len,
        .buffer = buffer,
        .delimiter = delimiter,
    };
}