1

BoostまたはSTLのQStringListに代わるものはありますか?私が達成したいのは、パスを分割することです。dvb://1.2.3.4/launchpad/dyn/index.htmは、QStringリストで簡単に実行できるように文字列を分離します。

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

ありがとうございました。

4

1 に答える 1

1

boost::splitstd::vector<std::string>1つまたは複数の区切り文字に基づいて、文字列をに分割できます。

#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("/"));
于 2012-10-16T11:16:06.997 に答える