On Thursday, 13 May 2021 at 17:13:40 UTC, kdevel wrote:
On Thursday, 13 May 2021 at 16:40:29 UTC, Imperatorn wrote:Wouldn't this just this do that? 🤔```d string dequote(string s) { return s[1..$-1]; } ```1. Your code throws Range errors if s.length < 2. 2. assert(dequote(`"fo\"o"`) == `fo"o`) fails 3. dequote(`"fo"o"`) does not throw.
WI spent 2 seconds thinking about it and 18 seconds typing on my phone so I'm not so surprised it didn't work. It did "Ok" for a 20 sec attempt tho 😁