Reading a line from stdin

Jesse Phillips jessekphillips+D at gmail.com
Wed Mar 16 10:25:09 PDT 2011


Kai Meyer Wrote:

> Second, D doesn't seem to have a graceful way of reading an endless 
> stream of <your favorite data type> delimited by <your favorite 
> delimiting character>. I think readf is rigid, and works great in some 
> cases. I would greatly appreciate something more flexible like C++'s 
> extraction operator (operator>>) though. For example:

There is interest in getting a CSV parser in D. Of which I was hoping to be able to make use of a ForwardRange with Slicing... but could not find a way turn a buffered input range into a forward range. This made my second attempt useless for input ranges.

https://github.com/he-the-great/JPDLibs/tree/csv

https://github.com/he-the-great/JPDLibs/tree/separator

The benefit of the second is that you can using string to make a separator, or would be if startsWith worked as I want. But started working on the first to make it closer to what should be available in the standard library.


More information about the Digitalmars-d-learn mailing list