0Pricing
Zig Academy · Lesson

Formatting Text with std.fmt

Build strings with format specifiers.

Why Formatting

Real programs stitch values into text: names, counts, prices. Zig handles this through std.fmt and its format-string mini-language.

Placeholders in Braces

A format string uses {} as a placeholder. Each pair of braces pulls the next argument from the tuple you pass alongside it.

std.debug.print("x = {}\n", .{42});

All lessons in this course

  1. Strings Are []const u8
  2. String Literals and Escapes
  3. Comparing and Searching Bytes
  4. Formatting Text with std.fmt
← Back to Zig Academy