digitalmars.D.learn - multiline string literal with CRLF
- Marek Janukowicz (5/5) Aug 26 2015 Is there any way to input such a literal? Both `...` and q"EOS...EOS" do...
- Adam D. Ruppe (5/8) Aug 26 2015 One way you could do it is to stick a .replace("\n", "\r\n") to
- anonymous (6/9) Aug 26 2015 I'm probably missing the point, but:
- Marek Janukowicz (6/18) Aug 26 2015 Thanks, this works - I don't know how I did it the first time, because I...
- Kagamin (3/3) Aug 27 2015 Another option:
Is there any way to input such a literal? Both `...` and q"EOS...EOS" do not allow escape sequences. I'm on Linux, but I need precisely CRLF, not just \n. -- Marek Janukowicz
Aug 26 2015
On Wednesday, 26 August 2015 at 18:28:02 UTC, Marek Janukowicz wrote:Is there any way to input such a literal? Both `...` and q"EOS...EOS" do not allow escape sequences. I'm on Linux, but I need precisely CRLF, not just \n.One way you could do it is to stick a .replace("\n", "\r\n") to the end of the literal. If it is in a compile time context, it will CTFE its way to a new literal for you.
Aug 26 2015
On Wednesday 26 August 2015 20:28, Marek Janukowicz wrote:Is there any way to input such a literal? Both `...` and q"EOS...EOS" do not allow escape sequences. I'm on Linux, but I need precisely CRLF, not just \n.I'm probably missing the point, but: "Hello\r\nworld" Or if you want to include the \n verbatim: "Hello\r world"
Aug 26 2015
anonymous wrote:Thanks, this works - I don't know how I did it the first time, because I definitely tried that and failed. The other solution by Adam also works - thanks. -- Marek JanukowiczIs there any way to input such a literal? Both `...` and q"EOS...EOS" do not allow escape sequences. I'm on Linux, but I need precisely CRLF, not just \n.I'm probably missing the point, but: "Hello\r\nworld" Or if you want to include the \n verbatim: "Hello\r world"
Aug 26 2015