On Thursday, 13 May 2021 at 14:10:08 UTC, cc wrote:
Does something to dequote (unquote? or what would you call it?)
a string exist in the standard library? I didn't see one in
std.string, just wondering before reinventing the wheel.
Something like:
```d
assert(dequote(`"foo"`) == "foo");
assert(dequote(`'foo'`) == "foo");
assert(dequote(`"foo's"`) == "foo's");
assert(dequote(`'foo "bar"'`) == `foo "bar"`);
assert(dequote(`"fo\"o"`) == `fo"o`);
dequote(`"fo"o"`); // bad quoting, maybe throw an exception
here or something?
```
Wouldn't this just this do that? 🤔
```d
string dequote(string s)
{
return s[1..$-1];
}
```