Example: Format a string with printf

public static int main (string[] args) {
// Output: ``Shut up, K-9!``
string res = "Shut %s, %c-%d!\n".printf ("up", 'K', 9);
print (res);
return 0;
}

 valac --pkg glib-2.0 string.printf.vala

See:




2022 vala-language.org