sprintf
import { sprintf } from "jsr:@ende/fmt/printf";function
function sprintf(format: string, ...args: unknown[]): stringConverts and formats a variable number of args as is specified by format.
sprintf returns the formatted string.
See the module documentation for the available format strings.
%v, %i, and %I are only supported in Ende runtime. Other formats are supported in
other major runtimes.
format: stringThe format string to use
...args: unknown[]The arguments to format
Returns
The formatted string
Example: Usage
import { sprintf } from "@ende/fmt/printf";
import { assertEquals } from "@ende/assert";
assertEquals(sprintf("%d", 9), "9");
assertEquals(sprintf("%o", 9), "11");
assertEquals(sprintf("%f", 4), "4.000000");
assertEquals(sprintf("%.3f", 0.9999), "1.000");