Basic module

sprint

procedure · 1 overloadSource

The text format_string makes with args, in a new string. See print_to_builder for the format. When the formatting fails the result is an empty string and an error has been logged. It is allocated with the context allocator and the caller frees it with free. Use tprint to avoid freeing.

sprint :: (format_string: string, args: ..Any) -> string

Parameters

format_string: string
args: ..Any

Returns

string
ExampleOpen in playground ↗
s := sprint("% is %", "x", 5);
defer free(s);
assert(s == "x is 5");

See also