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.
Zig › std/ › fmt/ › parse_float/ › FloatStream.zig › scanDigit
scanDigit
FloatStream.scanDigit
pub fn scanDigit (self : *FloatStream , comptime base : u8 ) ?u8
File
Code
pub fn scanDigit (self : *FloatStream , comptime base : u8 ) ?u8 {
comptime std .debug .assert (base == 10 or base == 16 );
retry : while (true ) {
if (self .first ()) |ok | {
if ('0' <= ok and ok <= '9' ) {
self .advance (1 );
return ok - '0' ;
} else if (base == 16 and 'a' <= ok and ok <= 'f' ) {
self .advance (1 );
return ok - 'a' + 10 ;
} else if (base == 16 and 'A' <= ok and ok <= 'F' ) {
self .advance (1 );
return ok - 'A' + 10 ;
} else if (ok == '_' ) {
self .advance (1 );
self .underscore_count += 1 ;
continue :retry ;
}
}
return null ;
}
}