std.range.byLine
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Sep 11 14:29:14 PDT 2014
On Thursday, 11 September 2014 at 20:03:26 UTC, Nordlöw wrote:
> On Thursday, 11 September 2014 at 10:19:17 UTC, monarch_dodra
> wrote:
>> Well, the issue is that this isn't very portable for
>> *reading*, as even on linux, you may read files with "\r\n"
>> line endings (It's "standard" for csv files, for example), or
>> read "\n" terminated files on windows.
>> The issue is that (currently) we don't have any splitter that
>> operates on multiple needles. *That'd* be what needs to be
>> written (probably not too hard either, since "find" already
>> exists).
>
> Good idea. So its "just" a matter of extending splitter with
> std.algorithm.find with these three keys:
> - \n
> - \r
> - \r\n
> then? Or are there more encodings to choose from?
Hum... no, those are the correct splitting elements. However, I
don't think that would actually work, as "find" will privilege
the first whole element to match as a "hit", so "\r\n" never be
hit (rather, it will be hit twice, in the form of two individual
line breaks `\r` and '\n').
Bummer...
More information about the Digitalmars-d-learn
mailing list