@printf
does not accept *
for passing precision or width as argument
#40654
Labels
@printf
does not accept *
for passing precision or width as argument
#40654
The docs on
@printf
state that it follows C-style formatting as specified here. This spec allows for*
to be used in the precision and/or width positions to indicate that the precision and/or width will be passed as additional arguments preceding the value to be formatted. Example (in C):Currently (Julia 1.6.1),
@pritnf
does not recognize such format specifiers.@printf "%.*f" 2 3.141
fails withArgumentError: invalid format string: '%.*f', invalid type specifier: '*'
.I don't know whether not supporting this is intended behavior or not. If it is, the docs should be updated to say how Julia's
@printf
differs from the C-style spec.Here is an example where having this would be useful:
The text was updated successfully, but these errors were encountered: