Should this work?
Jakob Ovrum
jakobovrum at gmail.com
Fri Jan 10 20:32:06 PST 2014
On Saturday, 11 January 2014 at 03:49:28 UTC, Manu wrote:
> Since you mentioned it here yesterday, I thought 'byLine' would
> be useful
> this morning... but I can't find it!
> This is an embarrassing theme.
>
> Does it actually exist, and I am even further retarded... or
> did you just
> make that up?
>
> File seems to have one, but that's no good for general text
> processing.
> I can see std.string.splitLines, but that's not the same thing;
> it
> allocates in a case where I don't need to.
std.algorithm.splitter and std.regex.splitter can easily be
leveraged to split lines.
However, a convenient, generic `byLine` algorithm that splits on
any Unicode line break sequence in a carefully defined manner
that guarantees optimal performance might be something we need to
add to Phobos. When composing with `splitter`, the user is prone
to introducing subtle limitations, like relying on "\r\n" vs "\n"
or not supporting the non-ASCII line break characters, and is
prone to introducing bugs due to subtle behaviour on empty lines.
More information about the Digitalmars-d
mailing list