It might be useful to do this kind of thing with a filter
function:

string escape(string s) { return s.replace("\n", "\\n"); }

auto foo = "cool\nstuff";
string lol = mixin(x("blah $foo", escape));

assert(lol == "blah cool\\nstuff");

Reply via email to