Skip to main content
Add sample code and output
Source Link
congusbongus
  • 14.2k
  • 8
  • 76
  • 104

Boost has a strong split function: boost::algorithm::split.

Sample program:

#include <vector>
#include <boost/algorithm/string.hpp>

int main() {
    auto s = "a,b, c ,,e,f,";
    std::vector<std::string> fields;
    boost::split(fields, s, boost::is_any_of(","));
    for (const auto& field : fields)
        std::cout << "\"" << field << "\"\n";
    return 0;
}

Output:

"a"
"b"
" c "
""
"e"
"f"
""

Boost has a strong split function: boost::algorithm::split.

Boost has a strong split function: boost::algorithm::split.

Sample program:

#include <vector>
#include <boost/algorithm/string.hpp>

int main() {
    auto s = "a,b, c ,,e,f,";
    std::vector<std::string> fields;
    boost::split(fields, s, boost::is_any_of(","));
    for (const auto& field : fields)
        std::cout << "\"" << field << "\"\n";
    return 0;
}

Output:

"a"
"b"
" c "
""
"e"
"f"
""
added 64 characters in body
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 109
  • 132

boostBoost has a strong split function:

   boost::algorithm::split.

boost has a strong split function:

 boost::algorithm::split

Boost has a strong split function:  boost::algorithm::split.

Source Link
Raz
  • 1.9k
  • 2
  • 18
  • 23

boost has a strong split function:

boost::algorithm::split