1

Is there any alternative to QStringList in Boost or STL. What I want to achieve is to split path eg. dvb://1.2.3.4/launchpad/dyn/index.htm to separate strings as it can by done simply in QString List:

QStringList path = objectPath.split(QChar('/'), QString::SkipEmptyParts);

Thank You.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
bartebly
  • 29
  • 1
  • 4

1 Answers1

1

boost::split can split a string into a std::vector<std::string>, based on one or multiple delimiters:

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

std::vector<std::string> path_parts;
std::string s("some/file/path");
boost::split(path_parts, s, boost::is_any_of("/"));
hmjd
  • 120,187
  • 20
  • 207
  • 252