Looking for an equivalent to C++ std::getline in D

k-five via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 5 02:54:03 PDT 2017


Hi all.
I have a simple command-line program utility in C++ that can 
rename or remove files, based on regular expression.
After finding D that is more fun than C++ is, I want to port the 
code, but I have problem with this part of it:

         std::getline( iss, match, delimiter );
         std::getline( iss, substitute, delimiter );

I need to read from iss ( = std::istringstream iss( argv[ 1 ] ) 
and separate them by delimiter.

Since the program gets the input from a user, and it can be 
something like: 's/\d+[a-z]+@(?=\.)//g'  or '/[A-Za-z0-9]+//'

So for: s/\d+[a-z]+@(?=\.)//g
I need:
s
\d+[a-z]+@(?=\.)
g

and for: /[A-Za-z0-9]+/
It should be:
[A-Za-z0-9]+

---

I tired ( std.string: split or format ) or ( std.regex split ). 
In fact I need to read from a stream up to a delimiter.

Does someone knows a way to do this in D? Thanks


More information about the Digitalmars-d-learn mailing list