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.

isValidNumberDataLiteral

rc is maximally liberal in terms of what it accepts as a number literal for data values. As long as it starts with a number or - or ~, that's good enough.

literals.isValidNumberDataLiteral
pub fn isValidNumberDataLiteral(str: []const u8) bool

File

Code

pub fn isValidNumberDataLiteral(str: []const u8) bool {
    if (str.len == 0) return false;
    switch (str[0]) {
        '~', '-', '0'...'9' => return true,
        else => return false,
    }
}