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.
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.007813source
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.6source
© 2009–2019 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors
Licensed under the MIT License.
https://docs.julialang.org/en/v1.0.4/stdlib/Printf/