On Sunday, 2 January 2022 at 21:16:55 UTC, Amit wrote:
On Sunday, 2 January 2022 at 19:26:50 UTC, WebFreak001 wrote:
[...]

On Sunday, 2 January 2022 at 19:37:38 UTC, JG wrote:
[...]

Yes! That's what I needed.

I wrapped it in a function like so:

```d
string quote(string s) {
    return format("%s", [s])[1 .. $ - 1];
}
unittest {
assert(quote("one \"two\"\nthree four") == `"one \"two\"\nthree four"`);
}
```

Thanks for your responses ^_^

Hi, I also need a function to "unquote" string, like this:
```d
assert(unquote(`\n`)=="\n");
```
Is there a way to do that?

Reply via email to