void splitString(const std::string &str, const std::string &separator, std::vector<std::string> &retList)
{
string::size_type pos=0;
string::size_type newPos=0;
retList.clear();
while( (newPos= str.find(separator,pos)) != string::npos)
{
// if not empty sub str. (skip repetition of separator )
if(newPos-pos>0)
retList.push_back(str.substr(pos, newPos-pos));
// skip token
pos= newPos+separator.size();
}
// copy the last substr
if( pos<str.size() )
retList.push_back(str.substr(pos, str.size()-pos));
}
{
string::size_type pos=0;
string::size_type newPos=0;
retList.clear();
while( (newPos= str.find(separator,pos)) != string::npos)
{
// if not empty sub str. (skip repetition of separator )
if(newPos-pos>0)
retList.push_back(str.substr(pos, newPos-pos));
// skip token
pos= newPos+separator.size();
}
// copy the last substr
if( pos<str.size() )
retList.push_back(str.substr(pos, str.size()-pos));
}