Small iterators/algorithm usage feedback

Derek Parnell derek at psych.ward
Sun Apr 26 15:11:12 PDT 2009


On Mon, 27 Apr 2009 01:53:27 +0400, Denis Koroskin wrote:

> I have just started using iterators and algorithms a little.
> Given a full file path, a needed to get folder name where
> it is located, and a name of the that file.
> 
> Using C and its standard library, I can do it as follows:
> 
> auto pos = strrpos(fullFilePath, '/'); // strrpos = strpos-reverse
> string dirName = fullFilePath[0..pos];
> string fileName = fullFilePath[pos+1..$];
> 
> It's very simple, I'd use it, but there is no strrpos (nor strpos) in Phobos/druntime.
> So I tried using the following code: ...

I merely wrote my own version of strrpos() etc ... I at least know what it
does and why it does it. But this was before any of the 'range' stuff in D
was thought of.

Sorry I can't be of any help.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list