Basic module

print_to_builder

procedure · 1 overloadSource

Appends text to builder as format_string describes, and returns whether it worked. Each % takes the next of args and writes it in its default form; %1, %2, ... pick an argument by position. A format with too few arguments logs an error. Returns false if the builder ran out of memory.

print_to_builder :: (
    builder: *String_Builder,
    format_string: string,
    args: ..Any
) -> bool

Parameters

builder: *String_Builder
format_string: string
args: ..Any

Returns

bool
ExampleOpen in playground ↗
builder: String_Builder;
print_to_builder(*builder, "% + % = %", 1, 2, 3);
result := builder_to_string(*builder);
defer free(result);
assert(result == "1 + 2 = 3");

See also