String "dequote" in phobos?
cc
cc at nevernet.com
Thu May 13 14:10:08 UTC 2021
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?
```
More information about the Digitalmars-d-learn
mailing list