On Sun, 14 Dec 2014 05:15:43 +
earthfront via Digitalmars-d-learn
wrote:
> On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > auto names = File("names.txt")
> > .byLine!(char,char)(KeepTerminator.no, ',')
> > .map!"a.idup"
> >
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
Digitalmars-d-learn wrote:
auto names = File("names.txt")
.byLine!(char,char)(KeepTerminator.no, ',')
.map!"a.idup"
.array;
Awesome. "map!idup" does the trick.
I had looked at the "byLine" doc before posting,
On Sat, 13 Dec 2014 12:07:27 +
thedeemon via Digitalmars-d-learn
wrote:
> On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
> Digitalmars-d-learn wrote:
> > .map!"a.idup"
>
> That can be just .map!idup.
it depends of compiler version, as `idup` was a property some time ago.
better b
On Saturday, 13 December 2014 at 06:40:41 UTC, ketmar via
Digitalmars-d-learn wrote:
.map!"a.idup"
That can be just .map!idup.
On Sat, 13 Dec 2014 10:01:49 +
bearophile via Digitalmars-d-learn
wrote:
> > no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses
> > it's
> > internal buffer for each line, so you have to copy that buffer.
>
> A simple solution is to use byLineCopy (that unfortunately should
> ha
ketmar:
no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses
it's
internal buffer for each line, so you have to copy that buffer.
A simple solution is to use byLineCopy (that unfortunately should
have been the default behavior since the beginning).
Bye,
bearophile
On Sat, 13 Dec 2014 05:15:08 +
earthfront via Digitalmars-d-learn
wrote:
> Am I using array incorrectly?
no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses it's
internal buffer for each line, so you have to copy that buffer. like
this:
import std.array, std.stdio;
void main (