Because before the trim strTok can be not empty. After the trim it can be. If it is, the following code lines are useless.
I can't understand the
continue, instead. Used that way the next line of the string will never be tokenized.
You need:
Quote
strTok = strLinks.Tokenize(_T("\t\n\r"), curPos);
before the
continue.
Or I am missing something?
/edit: to complete the example:
Quote
CString strTok = strLinks.Tokenize(_T("\t\n\r"), curPos);
while (!strTok.IsEmpty())
{
strTok.Trim();
if(strTok.IsEmpty()) {
strTok = strLinks.Tokenize(_T("\t\n\r"), curPos);
continue;
}
if (strTok.Right(1) != _T("/"))
strTok += _T("/");
try
...
Which can be optimized a lot putting the Tokenize into the while check statement, I think, but this is not really required.
This post has been edited by CiccioBastardo: 07 August 2006 - 08:10 PM