
9 Oct
2006
9 Oct
'06
11:20 a.m.
The following code: using namespace boost::algorithm; std::string test("DataItem.item[4]"); std::vector< std::string > path; split(path,test,is_any_of(".[]"),token_compress_on); for(int i=0;i<path.size();i++) { const char* dbg=path[i].c_str(); std::cout<<path[i]<<std::endl; } std::cout<<" DONE!"<<std::endl; produces the following output: DataItem 4 <null string> DONE! This happens every time the test string ends with a terminator. Is this the desired behaviour? It seems to me that it is more intuitive if the split returns just the first two items without the final <null> string. Regards, Luca Regini