Anonymous user
Brace expansion: Difference between revisions
Updated D entry
(→{{header|Java}}: small changes) |
(Updated D entry) |
||
Line 504:
{{trans|Python}}
This code is not UTF-corrected, because it uses slicing instead of front, popFront, etc.
<lang d>import std.stdio, std.typecons, std.array, std.range, std.algorithm, std.string;
Nullable!(Tuple!(string[], string)) getGroup(string s, in uint depth)
/*pure*/ @safe {
string[] sout;
auto comma = false;
while (!s.empty) {
//
const r = getItems(s, depth);
const g = r[0];
Line 536:
}
Tuple!(string[], string) getItems(string s, in uint depth=0) /*pure*/ @safe {
auto sout = [""];
Line 547:
const x = getGroup(s.dropOne, depth + 1);
if (!x.isNull) {
s = x[1];
continue;
|