Nonsense not much to say, directly on the example and code:
For link strURL = http://local/Fun=cmd_popupwindow&p1=http://www.hao123.com
According to the delimiter "&" and "=" can parse out the function name Cmd_popupwindow and parameter link http://www.hao123.com
Note: The following code, regardless of the link parameters, as long as the delimiter is & can.
1 voidUmsframebottom::analasisurl (Constcstring& strURL, TCHAR csplit, cstringarray&arycstring)2 {3 Arycstring.removeall ();4 intNPOs =0;5 intNnewpos =-1;6 intNurllen =strurl.getlength ();7 intNcsplit =1;8 9 if(nurllen<0)return ;Tenstd::vector<int>aryposition; OneNnewpos = Strurl.find (Csplit,0); A - if(nnewpos<0) - { the Arycstring.add (strurl); - return ; - } - while(nnewpos>NPOs) + { - Aryposition.push_back (nnewpos); +NPOs =Nnewpos; ANnewpos = Strurl.find (Csplit, npos+1); at } - CString strsub1,strsub; - for(intI=0; I<=aryposition.size (); ++i) - { - strsub.empty (); - if(i = =0) in { -StrSub1 =Strurl.mid (i, aryposition[i]); to intSubpos = Strsub1.find (_t ("="),0); +Strsub = Strsub1.right (Strsub1.getlength ()-subpos-1); - } the Else * { $ if(i = =aryposition.size ())Panax Notoginseng { -StrSub1 = Strurl.mid (aryposition[i-1]+ncsplit); the intSubpos = Strsub1.find (_t ("="),0); +Strsub = Strsub1.right (Strsub1.getlength ()-subpos-1); A } the Else if(i>0) + { -StrSub1 = Strurl.mid (aryposition[i-1]+ncsplit, aryposition[i]-aryposition[i-1]-ncsplit); $ intSubpos = Strsub1.find (_t ("="),0); $Strsub = Strsub1.right (Strsub1.getlength ()-subpos-1); - } - } the - if(Strsub.isempty ())Wuyi Continue; the - Arycstring.add (strsub); Wu - } About $ -}
This gets the Cstringarry array arycstring will get the function name and the parameter link ...
How to parse Web links