Index
fn Fprint(mut w: io::Writer, args: ...any)!
fn Fprintln(mut w: io::Writer, args: ...any)!
fn Fprintf(mut w: io::Writer, fmt: string, args: ...any)!
fn Printf(fmt: string, args: ...any)
fn Print(args: ...any)
fn Println(args: ...any)
fn Sprint(args: ...any): string
fn Sprintg[T](t: T): string
fn Sprintf(fmt: string, args: ...any): string
Fprint
async fn Fprint(mut w: io::Writer, args: ...any)!Prints arguments to w with default formatting. See documentation of the [Sprint] function for formatting. Forwards errors, if any.
Fprintln
async fn Fprintln(mut w: io::Writer, args: ...any)!Prints arguments to w with default formatting. Prints new-line after arguments. See documentation of the [Sprint] function for formatting. Forwards errors, if any.
Fprintf
async fn Fprintf(mut w: io::Writer, fmt: string, args: ...any)!Prints result of formatting to w. See documentation of the [Sprintf] function for formatting. Forwards errors, if any.
Printf
fn Printf(fmt: string, args: ...any)Prints result of formatting to stdout. See documentation of the [Sprintf] function for formatting. Panics if any error appears. Write operation is blocking.
Print
fn Print(args: ...any)Prints arguments with default formatting to stdout. Panics if any error appears. Write operation is blocking.
Println
fn Println(args: ...any)Prints arguments with default formatting to stdout. Prints new-line after arguments. Panics if any error appears. Write operation is blocking.
Sprint
fn Sprint(args: ...any): stringReturns string result of arguments with default formatting. Arguments will be concatenated without any spaces.
Sprintg
fn Sprintg[T](t: T): stringReturns string result of argument with default formatting. It uses comptime to analysis type T. If type T is a dynamic or unsupported type, it jumps back to the [Sprint] algorithm.
Sprintf
fn Sprintf(fmt: string, args: ...any): stringFormats arguments according to the format string and returns the resulting string.
The format string is composed of ordinary text and replacement fields. Ordinary text is copied to the output unchanged.
Replacement fields are written between braces:
{} Selects the next argument in sequence
{index} Explicit argument selectionBraces can be escaped by doubling them:
{{ Writes a literal '{'
}} Writes a literal '}'
{{}} Writes a literal "{}"Automatic and explicit indexing may be mixed. Automatic placeholders consume arguments sequentially, while indexed placeholders always refer to the specified argument position.
The formatting behavior of individual argument types is implementation defined and may be customized by the caller or by type-specific formatters.
Format strings are malformed when:
- A replacement field is not closed
- An unexpected closing brace appears
- A field contains invalid syntax
- A field references an argument that does not exist
Parsing is performed from left to right and replacement fields are evaluated in the order they appear in the format string.
Missing arguments do not cause formatting to fail. If a replacement field refers to an argument that does not exist, the field is replaced with the special marker:
{!MISSING}Examples:
Sprintf("{} {}", "hello") -> "hello {!MISSING}"
Sprintf("{1}", "hello") -> "{!MISSING}"