Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Input-loop/D/input-loop-1.d
Normal file
23
Task/Input-loop/D/input-loop-1.d
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
void main() {
|
||||
import std.stdio;
|
||||
|
||||
immutable fileName = "input_loop1.d";
|
||||
|
||||
foreach (const line; fileName.File.byLine) {
|
||||
pragma(msg, typeof(line)); // Prints: const(char[])
|
||||
// line is a transient slice, so if you need to
|
||||
// retain it for later use, you have to .dup or .idup it.
|
||||
line.writeln; // Do something with each line.
|
||||
}
|
||||
|
||||
// Keeping the line terminators:
|
||||
foreach (const line; fileName.File.byLine(KeepTerminator.yes)) {
|
||||
// line is a transient slice.
|
||||
line.writeln;
|
||||
}
|
||||
|
||||
foreach (const string line; fileName.File.lines) {
|
||||
// line is a transient slice.
|
||||
line.writeln;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue