diff --git a/fmt.zig b/fmt.zig index c7d3a7d145566549bc2c74a9a90393ef5ed61e89..f9730b87e4d5928500e25c156f864e001fc4075e 100644 --- a/fmt.zig +++ b/fmt.zig @@ -824,6 +824,10 @@ pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) ![]u8 { }; return fbs.written(); } +pub fn bufPrintZ(buf: []u8, comptime fmt: []const u8, args: anytype) ![:0]u8 { + const result = try bufPrint(buf, fmt ++ "\x00", args); + return result[0 .. result.len - 1 :0]; +} const digits2_alphabet = blk: { var data: [200]u8 = @splat(0);