On 1/2/22 9:27 AM, Amit wrote:

> string s = "one \"two\"\nthree four";

The issue there is that the string does not contain the two characters \" but the single character ". So, that's a syntax issue. The solution is to use back ticks to tell the compiler what you really mean.

> And get as output
>
> ```
> "one \"two\"\nthree four"
> ```

import std.stdio;

void main() {
  string s = `one \"two\"\nthree four`;  // <-- Back ticks
  writeln(s);
}

Ali

Reply via email to