Hi Alexander, I’m not aware of a way to do this, but would also like to know how to do it.
— John On Feb 2, 2014, at 5:52 AM, Alexander Samoilov <[email protected]> wrote: > Hello, > > I have a format string - a "%Fmt" literal for @printf() and it is too large, > so would like to concatenate it from chunks, > say using string("chunk 1 ", " chunk 2 ", " chunk 3 ") > > @printf() disallow to do it as requires a string literal, but string() is a > function and the produced string variable cannot be checked vs. @printf() > args. > > julia> @printf(string("abc ", " def ", " ggg ")) > ERROR: first or second argument must be a format string > > Looks this is intentionally to have an opportunity to check format string vs. > parameters (at least check number of args). > > BTW, C allows gluing of a few consecutive strings, e.g. "abc " " def " " ggg > " into one string literal, though it doesn't look very aesthetic. > > Is it possible for Julia to construct a format string somehow and feed it to > @printf() or this is impossible in principle > and several invocations of @printf() should be used as workaround? > > Thanks, > Alexander
