File.byLine.map!idup.
The element type for the range will be Char[]. Range primitives may throw StdioException on I/O error.
Parameters
Char | Character type for each line, defaulting to immutable char. |
keepTerminator | Use Yes.keepTerminator to include the terminator at the end of each line. |
terminator | Line separator ('\n' by default). Use newline for portability (unless the file was opened in text mode). Example: ---- import std.algorithm, std.array, std.stdio; // Print sorted lines of a file. void main() { auto sortedLines = File("file.txt") // Open for reading .byLineCopy() // Read persistent lines .array() // into an array .sort(); // then sort them foreach (line; sortedLines) writeln(line); } ---- |