I have a
first case:
CString stVal = " dsc | resource.c |* ";
in Second case:
CString stVal = " resource.c |MS";
I want only file name in both case.
Please note that I am using visual studio 6.0.
have you any idea? Thanks in Advance.
I have a
first case:
CString stVal = " dsc | resource.c |* ";
in Second case:
CString stVal = " resource.c |MS";
I want only file name in both case.
Please note that I am using visual studio 6.0.
have you any idea? Thanks in Advance.
CString strLine= " dsc | resource.c |* ";
char* lpszToToken = stLine.GetBuffer(stLine.GetLength());
char* lpszToken = strtok(lpszToToken, "|");
while(lpszToken != NULL)
{
lpszToken = strtok(NULL, "|");
CString str = lpszToken;
if(str.Find(".") != -1) {
stLine = str;
break;
}
recently doing MFC experiment meeting the same problem, finnaly sovled by following code.
split(CString A) {
CStringList* returnStringList = new CStringList;
CString Seperator = L"|";//custom your serperator here
int position = 0;
CString token = A.Tokenize(Seperator, position);
returnStringList->AddTail(token);
while (!token.IsEmpty()) {
token = A.Tokenize(Seperator, position);
returnStringList->AddTail(token);
}
return returnStringList;
}