Boost logo

Boost :

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

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:

Maybe, something like this can be added?

- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at