string.printf
Defined in module
"string"from "string" import printfFormats fmt with the following arguments and writes the result to the same output as print, without building and returning a throwaway string.
Parameters
fmt | string | the format string |
... | any | one value per conversion in fmt repeats |
Return value
null, always; the formatted text goes to the print output, not to the caller.
Errors
The same as format, since printf builds the string the same way before writing it.
Example
from "string" import printf
// same formatting rules as format(), but writes the result instead of
// returning it, without building a throwaway string first
printf("%s = %d\n", "answer", 42)
// the call itself evaluates to null
println(printf("%d\n", 1) == null)Output:
answer = 42
1
trueSee also
format | Formats fmt with the following arguments, following the syntax of the C printf family, and returns the result as a new string. |
| string | module index |