authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-19 19:38:57 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-06-19 19:39:44 -07:00
logd05d189fe2710c39746dc1ecbe3010c615f58b92
tree4c447618394616b895b2eb82625dd9d7b0170b6e
parentd4e2c02bb7cd1a8e23fa2b777fa281d69e6b5851

add parse_bool


1 files changed, 4 insertions(+), 0 deletions(-)

src/lib.zig+4
...@@ -519,3 +519,7 @@ pub fn parse_int(comptime T: type, s: ?string, b: u8, d: T) T {...@@ -519,3 +519,7 @@ pub fn parse_int(comptime T: type, s: ?string, b: u8, d: T) T {
519 if (s == null) return d;519 if (s == null) return d;
520 return std.fmt.parseInt(T, s.?, b) catch d;520 return std.fmt.parseInt(T, s.?, b) catch d;
521}521}
522
523pub fn parse_bool(s: ?string) bool {
524 return parse_int(u1, s, 10, 0) > 0;
525}