www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - escape string into a C style string litteral (pasteable in C code)

Is there an existing way to do it or do I have to roll my own?
  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
Jun 11 2014