Boost logo

Boost Users :

From: abir basak (abirbasak_at_[hidden])
Date: 2007-02-16 05:39:13


Hi,
   I want to tokenize a string based on one or multiple space or tab

std::string s = " a b c d \te ";
        std::vector<std::string> tokens;
        boost::algorithm::split(tokens,s,boost::algorithm::is_any_of("
\t"),token_compress_on);
copy(tokens.begin(),tokens.end(),ostream_iterator<string>(cout,"\n"));

This gives more or less correct result, except it does not remove space/
tab from begin /end.
It can be done like trim(s); and then call the above.
But is there any other way it can be done in split itself ?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net