On 2014-03-16 12:58, Andrei Alexandrescu wrote:
A classic idiom for reading lines and keeping them is f.byLine.map!(x =>
x.idup) to get strings instead of the buffer etc.

The current behavior trips new users on occasion, and the idiom solving
it is very frequent. So what the heck - let's put that in a function,
expose and document it nicely, and call it a day.

A good name would help a lot. Let's paint that bikeshed!


Andrei

string[] split(File f, char[] sep = "\n"[, size_t max = 0]);

auto ln = f.split("\n", 15); // returns a gc allocated array of 15 lines

Reply via email to