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.

printSentinel

Like print but returned slice has the provided sentinel.

mem.printSentinel
pub fn printSentinel(
    buffer: []u8,
    comptime format: []const u8,
    args: anytype,
    comptime sentinel: u8,
) PrintError![:sentinel]u8

File

lib/std/mem.zig:5186

Code

pub fn printSentinel(
    buffer: []u8,
    comptime format: []const u8,
    args: anytype,
    comptime sentinel: u8,
) PrintError![:sentinel]u8 {
    const result = try print(buffer, format ++ [1]u8{sentinel}, args);
    return result[0 .. result.len - 1 :sentinel];
}