pub fn parseIntWithGenericCharacter(
comptime Result: type,
comptime Character: type,
buf: []const Character,
base: u8,
) ParseIntError!Result Result: typeCharacter: typebuf: []const Characterbase: u8OverflowThe result cannot fit in the type specified.
InvalidCharacterThe input was empty or contained an invalid character.
327
328
329
330
331
332
333
334
335
336
337pub fn parseIntWithGenericCharacter(
comptime Result: type,
comptime Character: type,
buf: []const Character,
base: u8,
) ParseIntError!Result {
if (buf.len == 0) return error.InvalidCharacter;
if (buf[0] == '+') return parseIntWithSign(Result, Character, buf[1..], base, .pos);
if (buf[0] == '-') return parseIntWithSign(Result, Character, buf[1..], base, .neg);
return parseIntWithSign(Result, Character, buf, base, .pos);
}
Like
parseInt, but with a genericCharactertype.