Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-08 01:59:32


Hello,
suppose I have a string "module.foo1.port" and want to get the second
dot-separated element. I think I can use the 'split' algorithm, but it does
not look very convenient, I need to declare container, then call split and
then obtain the result.

In Qt, there's QString::section method, which allows to do this in one line.
Here's example from the docs:

    QString csv( "forename,middlename,surname,phone" );
    QString s = csv.section( ',', 2, 2 ); // s == "surname"

And the complete docs are at:

    http://doc.trolltech.com/3.3/qstring.html#section

Maybe, something like this can be added?

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk