Boost logo

Boost Users :

Subject: Re: [Boost-users] tokenize string delimiter
From: Matthias Vallentin (vallentin_at_[hidden])
Date: 2010-02-09 20:58:32


On Tue, Feb 09, 2010 at 02:00:10PM +0530, Lloyd wrote:
> Is it possibleto tokenize a string based on a string delimiter?

Let str be the string to split and delim your delimiter. Then,

    std::vector<std::string> result;
    boost::iter_split(result, str, boost::first_finder(delim));

Or case insensitive:

    std::vector<std::string> result;
    boost::iter_split(result, str,
        boost::first_finder(delim, boost::is_iequal()));

HTH,

   Matthias

-- 
Matthias Vallentin
vallentin_at_[hidden]
http://www.icir.org/matthias

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