2012-10-16 2 views
1

Boost 또는 STL의 QStringList에 대한 대안이 있습니까? 내가 성취하고자하는 것은 경로를 나누는 것입니다. DVB : 그것은 QString 목록에서 간단히 수행에 의해 수있는 별도의 문자열에 //1.2.3.4/launchpad/dyn/index.htm : STL 또는 부스트의 QStringList 대체물

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

당신을 감사드립니다.

+1

http://stackoverflow.com/questions/236129/splitting-a-string-in-c – SingerOfTheFall

답변

1

boost::split은 하나 개 또는 여러 개의 구분 기호를 기반으로하는 std::vector<std::string>로 문자열을 분할 할 수 있습니다 :

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