Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

parseUnsigned

Public Function
std.fmt.parseUnsigned
pub fn parseUnsigned(comptime T: type, buf: []const u8, base: u8) ParseIntError!T

Parses the string buf as unsigned representation in the specified base of an integral value of type T.

When base is zero the string prefix is examined to detect the true base:

  • A prefix of "0b" implies base=2,
  • A prefix of "0o" implies base=8,
  • A prefix of "0x" implies base=16,
  • Otherwise base=10 is assumed.

Ignores '_' character in buf. See also parseInt.

Params

  • T: type
  • buf: []const u8
  • base: u8

Errors

Overflow

The result cannot fit in the type specified.

InvalidCharacter

The input was empty or contained an invalid character.

File

fmt.zig:478
478
479
480
pub fn parseUnsigned(comptime T: type, buf: []const u8, base: u8) ParseIntError!T {
    return parseIntWithSign(T, u8, buf, base, .pos);
}