You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to create a string from a custom format, it seems like I am supposed to use cfmt or format, but these do not have complete flexibility.
For example, if I want to create a string for $\pi$ surrounded by parentheses ((3.14)), how would I do that? printfmtln will display it: printfmtln("({:0.2f})", π), but this returns nothing (so it cannot be used later in the program). I tried cfmt but cfmt("(%0.2f)", π) causes an error. It is possible through format by running format(-π; parens=true) but this is not always work if I want something else besides parentheses.
With Printf, this is possible: Printf.format(Printf.Format("(%0.2f)"), π) will return a string. So can cfmt be extended to accept similar options?
The text was updated successfully, but these errors were encountered:
It would probably be better to use StrFormat.jl, which adds formatting (as well as other functionality, both with C style and Python style, provided by Format.jl) to interpolated strings.
If I want to create a string from a custom format, it seems like I am supposed to use
cfmt
orformat
, but these do not have complete flexibility.For example, if I want to create a string for$\pi$ surrounded by parentheses (
(3.14)
), how would I do that?printfmtln
will display it:printfmtln("({:0.2f})", π)
, but this returns nothing (so it cannot be used later in the program). I triedcfmt
butcfmt("(%0.2f)", π)
causes an error. It is possible throughformat
by runningformat(-π; parens=true)
but this is not always work if I want something else besides parentheses.With Printf, this is possible:
Printf.format(Printf.Format("(%0.2f)"), π)
will return a string. So cancfmt
be extended to accept similar options?The text was updated successfully, but these errors were encountered: