If you wanted to do it manualy, use the .find() function to find the first space, and .sub_str() to a temp string variable. Then .;push_back() that into the texts vector.
There's something in boost that can do it though, I think.
I used this recently to do something similar. I used a * instead of a ' ' though
Code:
void GetCatagories ( std::string List, std::vector<std::string> &Catagories )
{
if ( List != "" )
{
Catagories.clear();
int End = 0,
Start = 0;
while ( (End = List.find( '*', Start )) != -1 )
{
Catagories.push_back( List.substr( Start, End - Start ) );
Start = End+1;
}
Catagories.push_back( List.substr( Start, List.size() - Start ) );
}
}
EDIT :: change GetCatagories to ParseToVector or something. Change List to ToBeParsed. And perhaps Catagories to VecSubStr or something. The names I gave made sense to my project at the time, but probably aren't suited to yours.