Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,8 +1,23 @@
import tango.io.Console;
import tango.text.stream.LineIterator;
void main() {
import std.stdio;
void main (char[][] args) {
foreach (line; new LineIterator!(char)(Cin.input)) {
// do something with each line
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;
}
}

View file

@ -1,8 +1,8 @@
import tango.io.Console;
import tango.text.stream.SimpleIterator;
import tango.text.stream.LineIterator;
void main (char[][] args) {
foreach (word; new SimpleIterator!(char)(" ", Cin.input)) {
// do something with each word
foreach (line; new LineIterator!(char)(Cin.input)) {
// do something with each line
}
}

View file

@ -0,0 +1,8 @@
import tango.io.Console;
import tango.text.stream.SimpleIterator;
void main (char[][] args) {
foreach (word; new SimpleIterator!(char)(" ", Cin.input)) {
// do something with each word
}
}