My solution:
Code:
StringVector Split(const Strings::CStringEx& strToSplit, const Strings::CStringEx& strSplitWhat)
{
ppnew< std::vector<Strings::CStringEx> > pVector;
UINT nLastIndex = 0;
INT nIndex = 0;
while (nIndex != -1)
{
nIndex = strToSplit.Find(strSplitWhat, nLastIndex);
if (nIndex > -1)
{
//Strings::CStringEx strTemp = strToSplit.Mid(nLastIndex, nIndex - nLastIndex - 1);
//const TCHAR* str = strTemp;
pVector->push_back( strToSplit.Mid(nLastIndex, nIndex - nLastIndex) );
nLastIndex = (UINT)nIndex + strSplitWhat.GetLength();
}
}
pVector->push_back( strToSplit.Mid(nLastIndex) );
return pVector;
}
typedef std::vector<Strings::CStringEx> StringVector;
It should work on std::string, as well, if you could find proper functions to replace mid and find with.
Or alternatively, I could public my string class once it's finished.