Tuesday, 25 October 2016

c++ program to parse comma separated string

Input string is a comma separated string (s). output will be an std vector of string (vec).  


#include <iostream>
#include <boost/algorithm/string.hpp>
#include <vector>
int main()
{
    std::vector<std::string> vec;
    std::string s = "I,am,an,excellent,c++,programmer";

    boost::split(vec,s,boost::is_any_of(","));

    return 0;
}

No comments:

Post a Comment