Unpacking Slices
Vladimir Panteleev
thecybershadow.lists at gmail.com
Mon Jun 14 19:26:27 UTC 2021
On Monday, 14 June 2021 at 18:08:27 UTC, Justin Choi wrote:
> Is there any shortcut for unpacking slices like I'd want to do
> in a scenario like this?
> `info = readln.strip.split;`
> `string a = info[0], b = info[1], c = info[2];`
I tried to implement PHP's "list" language construct here, which
does something similar:
https://github.com/cybershadow/ae/blob/next/utils/array.d#L763
For your example, it would look like:
```d
string a, b, c;
list(a, b, c) = readln.strip.split;
```
More information about the Digitalmars-d-learn
mailing list