colla/docs/format.md
2024-11-29 16:10:48 +01:00

620 B

title = Format

title = Format

Format


Small formatting utility, it has 2 functions (and the va_list alternatives):

  • fmtPrint: equivalent to
  • fmtBuffer

It uses stb_sprintf under the hood, but it also has support for printing buffers using %v (structures that are a pair of pointer/size)

This means it can print strings and string views.

In

Usage example:

int main() {
    strview_t v = strv("world");
    char buffer[1024] = {0};

    fmtPrint("Hello %v!", v);
    fmtBuffer(buffer, sizeof(buffer), "Hello %v!", v);
}