| ... | ... | @@ -1131,6 +1131,11 @@ pub fn bufPrint(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintErro |
| 1131 | 1131 | return fbs.getWritten(); |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | pub fn bufPrintZ(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintError![:0]u8 { |
| 1135 | const result = try bufPrint(buf, fmt ++ "\x00", args); |
| 1136 | return result[0 .. result.len - 1 :0]; |
| 1137 | } |
| 1138 | |
| 1134 | 1139 | // Count the characters needed for format. Useful for preallocating memory |
| 1135 | 1140 | pub fn count(comptime fmt: []const u8, args: anytype) u64 { |
| 1136 | 1141 | var counting_writer = std.io.countingWriter(std.io.null_writer); |