Anonymous user
Range expansion: Difference between revisions
Updated D entry
m (→{{header|NetRexx}}: It's a translation too) |
(Updated D entry) |
||
Line 441:
=={{header|D}}==
{{trans|Python}}
<lang d>import std.stdio, std.regex, std.string, std.conv, std.range
std.algorithm;
int[] rangeExpand(in string txt) /*pure nothrow*/ {
const m = r.match(r"^(-?\d+)(-?(-?\d+))?$").captures.array;
iota(m[1].to!int, m[3].to!int + 1).array;
}).join.array;
}
|