does that work?
string escapeD(string a){
import std.array:replace;
return `r"`~a.replace(`"`,`" "\"" r"`)~`"`;
}
On Sun, Apr 20, 2014 at 11:14 AM, monarch_dodra via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Sunday, 20 April 2014 at 17:55:25 UTC, Ellery Newcomer wrote:
On Sunday, 20 April 2014 at 17:55:25 UTC, Ellery Newcomer wrote:
is there a function in phobos anywhere that takes a string and
escapes it into a string literal suitable for string mixins?
something like
assert (f("abc\ndef") == "\"abc\\ndef\"");
It's a bit hackish, but it avoids deploying c
is there a function in phobos anywhere that takes a string and
escapes it into a string literal suitable for string mixins?
something like
assert (f("abc\ndef") == "\"abc\\ndef\"");