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.

isValidScheme

scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

Uri.isValidScheme
fn isValidScheme(scheme: []const u8) bool

File

lib/std/Uri.zig:487

Code

fn isValidScheme(scheme: []const u8) bool {
    if (scheme.len == 0) return false;
    if (!std.ascii.isAlphabetic(scheme[0])) return false;
    for (scheme[1..]) |byte| {
        switch (byte) {
            'A'...'Z', 'a'...'z', '0'...'9', '+', '-', '.' => continue,
            else => return false,
        }
    }
    return true;
}