March 30, 2015 Re: string concatenation with %s | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Monday, 30 March 2015 at 17:34:20 UTC, Suliman wrote: >> string sss = format("foo"-", ""bar"); >> >> It should be obvious now that you forgot to escape those double quotes. > > Thanks! Is there any way to stay string as is. without need of it's escaping and so on? > > It's seems I have seen something like it in docs, but I am not sure about it... There are various other string literal forms [1] where you don't need to escape double quotes: AlternateWysiwygString - backticks as delimiters: `foo "-", "" bar` DelimitedString - can use delimiters of choice, here parentheses: q"(foo "-", "" bar)" TokenString - for D code, probably not a good choice here, but works: q{foo "-", "" bar} Of course, as they're all delimiter based, there will always something you can't put into the string verbatim. [1] http://dlang.org/lex.html#StringLiteral |
Copyright © 1999-2021 by the D Language Foundation