escape string into a C style string litteral (pasteable in C code)

Timothee Cour via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 11 11:15:53 PDT 2014


Is there an existing way to do it or do I have to roll my own?
unittest{
  assert(escapeC(`a"bc\ndef`~"\n") == `"a\"bc\\ndef\n"`);
}

Likewise with escapeD (pastable in D code), which would return something
like: `r"..."` for more readability
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140611/4b8ce20b/attachment.html>


More information about the Digitalmars-d-learn mailing list