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.

detectNewline

ConfigHeader.detectNewline
fn detectNewline(contents: []const u8) []const u8

File

lib/compiler/Maker/Step/ConfigHeader.zig:164

Code

fn detectNewline(contents: []const u8) []const u8 {
    const lf_index = std.mem.findScalar(u8, contents, '\n') orelse return os_newline;
    return if (lf_index > 0 and contents[lf_index - 1] == '\r') "\r\n" else "\n";
}