bartebly
bartebly

Reputation: 39

QStringList alternative in STL or Boost

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.

Upvotes: 1

Views: 934

Answers (1)

hmjd
hmjd

Reputation: 122001

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("/"));

Upvotes: 1

Related Questions