# Printf

`Printf.@printf` — Macro

    @printf([io::IOStream], "%Fmt", args...)

Print `args` using C `printf` style format specification string, with some caveats: `Inf` and `NaN` are printed consistently as `Inf` and `NaN` for flags `%a`, `%A`, `%e`, `%E`, `%f`, `%F`, `%g`, and `%G`. Furthermore, if a floating point number is equally close to the numeric values of two possible output strings, the output string further away from zero is chosen.

Optionally, an `IOStream` may be passed as the first argument to redirect output.

See also: `@sprintf`

Examples

    julia> @printf("%f %F %f %F\n", Inf, Inf, NaN, NaN)
    Inf Inf NaN NaN

    julia> @printf "%.0f %.1f %f\n" 0.5 0.025 -0.0078125
    1 0.0 -0.007813

source
`Printf.@sprintf` — Macro

    @sprintf("%Fmt", args...)

Return `@printf` formatted output as string.

Examples

    julia> s = @sprintf "this is a %s %15.1f" "test" 34.567;

    julia> println(s)
    this is a test            34.6

source

Theme

This document was generated with Documenter.jl on Thursday 11 March 2021. Using Julia version 1.5.4.