About the Zig category

Welcome to the Zig category. This is a space to ask any Zig questions, discuss exercises from the Exercism Zig track, or explore any other Zig-related conversations!

1 Like


About to learn Zig because the #12in23.

Reading the twofer made me think about how to do some String manipulation (interpolation?). Not as easy as I thought. The introductory docs I’ve found so far show a lot about that idea but with print (which I assume always implies a file and I/O … although maybe you can do such operations on strings (who knows? not me :-D (yet)).

Anyways, not required for official docs, but I’ve seen in other tracks some guidance on these basic tasks: something we could enhance here? how to?

I don’t know about documentation on exercism, but I can help out with the question on zig. The standard library contains a fmt module that can be used for string formatting. The functions expect a slice of bytes, an Allocator, or a Writer. In the case of twofer, the tests pass you a slice of bytes to use as a buffer, so I would recommend using std.fmt.bufPrint.

1 Like