Container Array

Vino.B via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 6 09:41:06 PDT 2017


HI All,

  Can some one provide me a example of how to use the 
std.container.array for the below code.

import std.algorithm: filter, map;
import std.file: SpanMode, dirEntries, isDir;
import std.stdio: writeln;
import std.typecons: tuple;
import std.array: array;

void main () {
	string[] Filesys = ["C:\\Temp\\TEST1\\BACKUP", 
"C:\\Temp\\TEST2\\EXPORT"];
	foreach(FFs; Filesys) {
		auto dFiles = dirEntries("C:\\Temp\\TEST1\\BACKUP", 
SpanMode.shallow).filter!(a => a.isDir).map!(a => tuple(a.name, 
a.size));
		foreach(d; dFiles)
		writeln(d[0], "\t", d[1]);
		}
}

From,
Vino.B


More information about the Digitalmars-d-learn mailing list