printf


Description:

[ PrintfFormat ]
public void printf (string format, ...)

Writes a formatted string into a StringBuilder.

This is similar to the standard sprintf function, except that the StringBuilder buffer automatically expands to contain the results. The previous contents of the StringBuilder are destroyed.

Example: Write a formatted string to the builder:

public static int main (string[] args) {
// Output: ``hello, world!``
StringBuilder builder = new StringBuilder ("foo bar foobar");
builder.printf ("%s,%s!\n", "hello", "world");
print (builder.str);
return 0;
}

valac --pkg glib-2.0 GLib.StringBuilder.printf.vala

Parameters:

this

a StringBuilder

format

the string format. See the printf documentation

...

the parameters to insert into the format string