How to parse the string
-
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
-
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
-
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
-
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
Use CString::ReverFind alongwith CString::Right or CString::Left to extract the string you want.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
Search for the '/' token (plain C)
strtok
[^]? (ATL/MFC)CStringT::Tokenize
[^]. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all.. I have the string of the following format. example: http://server/sharanu/inbox/test.jpg Now i want to get only the string inbox and sharanu.. can anyone help me.. thank you
CString str = "http://server/sharanu/inbox/test.jpg";
int i = str.ReverseFind('/');
str = str.Left(i);
CString sValue1 = str.Right(str.GetLength() - str.ReverseFind('/') -1);i = str.ReverseFind('/');
str = str.Left(i);
CString sValue2 = str.Right(str.GetLength() - str.ReverseFind('/') -1);