⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tanalyselink.cpp

📁 本程序是VC为平台开发的股票资讯系统
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    }
    else
        return "";

}

//--------------
bool  TAnalyseLink::IsVidLink(CString temp,CString filter)
{
      if (temp.IsEmpty()) return false;
     //if ((temp.AnsiPos("default"))||(temp.AnsiPos("Default"))||(temp.AnsiPos("DEFAULT")))
      if ((temp.Find("default")!=-1)||(temp.Find("Default")!=-1)||(temp.Find("DEFAULT")!=-1))
         return false;
      if (filter.IsEmpty()) return true;
      if (filter.Find("%")!=-1) {     //if (filter.AnsiPos("%")!=0) {
          filter.Delete(0,1);    //filter=filter.Delete(1,1);
          //filter=NewsDate.FormatString(filter.c_str());
          filter=NewsDate.Format(filter);
      }
      if (temp.Find(filter)==-1)      //if (temp.AnsiPos(filter)==0)
              return false;
      else    return true;
}

//------------------------
CString  TAnalyseLink::ClearTitle(CString temp,CString filter)
{
   int pos1=0,pos2=0;
   CString TempFilter;
   temp=ClearChar(temp,"nbsp");
   temp=ClearChar(temp,"Nbsp");
   temp=ClearChar(temp,"NBSP");
   while (1) {
       pos1=temp.Find("<");       //pos1=temp.AnsiPos("<");
       pos2=temp.Find(">");    //pos2=temp.AnsiPos(">");
       if (pos1>-1&&pos2>-1&&pos2>pos1)   // if (pos1>0&&pos2>0&&pos2>pos1)
//          temp.Delete(pos1-1,pos2-pos1+1);   //temp=temp.Delete(pos1,pos2-pos1+1);
          temp.Delete(pos1,pos2-pos1+1);   //temp=temp.Delete(pos1,pos2-pos1+1);
       else  if (pos1>-1&&pos2==-1)            // else  if (pos1>0&&pos2==0)
                 temp=temp.Mid(0,pos1);   //temp=temp.SubString(1,pos1-1);
       else
          break;
   }
  // temp=temp.Trim();
   pos1=1;
   if (!filter.IsEmpty()) {
      while (pos1>-1) {                  //while (pos1>0)
           pos1=filter.Find("&");       // pos1=filter.AnsiPos("&");
           if (pos1==-1) {                //if (pos1==0)
               while (1) {
                 pos2=temp.Find(filter);     //pos2=temp.AnsiPos(filter);
                 if (pos2>-1)                 //if (pos2>0)
//                    temp.Delete(pos2-1,filter.GetLength());  
                    temp.Delete(pos2,filter.GetLength());  
				 //temp=temp.Delete(pos2,filter.Length());
                 else break;
               }
               break;
           }
           else  {
                if (pos1!=0) {       // if (pos1!=1)
                    TempFilter=filter.Mid(0,pos1);   //TempFilter=filter.SubString(1,pos1-1);
                    while (1) {
                         pos2=temp.Find(TempFilter);   //pos2=temp.AnsiPos(TempFilter);
                         if (pos2>-1)                   //if (pos2>0)
                         //temp=temp.Delete(pos2,TempFilter.Length());
//                            temp.Delete(pos2-1,TempFilter.GetLength());
                            temp.Delete(pos2,TempFilter.GetLength());
                         else break;
                    }
                }
                filter.Delete(0,pos1+1);   //filter=filter.Delete(1,pos1);
           }
      }
   }

   while (1) {
        pos2=temp.Find("  "); //pos2=temp.AnsiPos("  ");
        if (pos2==-1) break;   //if (pos2==0)
//        temp.Delete(pos2-1,1); 
        temp.Delete(pos2,1); 
		//temp=temp.Delete(pos2,1);
   }
   temp=ClearChar(temp,'\n');
   temp=ClearChar(temp,'\r');
   temp=ClearChar(temp,';');
   temp=GetBrief(temp);
   return ClearChar(temp,"&");
}

//------------------
bool  TAnalyseLink::IsVidTitle(CString temp, CString filter)
{
   if (!TempKey.IsEmpty()) return true;
   temp=ClearChar(temp," ");
   if (temp.IsEmpty()) return false;
   if (filter.IsEmpty()) return true;
   if (filter.Find("&")!=-1)   return true;  //if (filter.AnsiPos("&")!=0)
   if (filter.Find("%")!=-1)    {
      filter.Delete(0,1);      //filter=filter.Delete(1,1);
      filter=NewsDate.Format(filter);
   }
   if (temp.Find(filter)==-1)   //if (temp.AnsiPos(filter)==0)
      return false;
   else    return true;
}

//------------
CString  TAnalyseLink::ClearLink(CString temp)
{
     int pos=0,n=0;
     CString cc="~~~";
     if (temp.Find("./")!=-1)  {cc="./";  n=2;}   //if (temp.AnsiPos("./")!=0)
     if (temp.Find("../")!=-1) { cc="../";n=3;}   //if (temp.AnsiPos("../")!=0)
     while (1) {
            pos=temp.Find(cc);   //pos=temp.AnsiPos(cc);
            if (pos==-1) break;       //if (pos==0)
//            temp.Delete(pos-1,n);   //temp=temp.Delete(pos,n);
            temp.Delete(pos,n);   //temp=temp.Delete(pos,n);
     }
     if (temp.IsEmpty())  {
          if (n!=0) return TempBaseLink;
          else return "";
     }
//if (temp[1]=='"') temp=temp.Delete(1,1);
     if (temp[0]=='"') temp.Delete(0,1);
// if (temp[temp.Length()]=='"')  temp=temp.Delete(temp.Length(),1);
     if (temp[temp.GetLength()-1]=='"')  
		 temp.Delete(temp.GetLength()-1,1);
//if (temp.AnsiPos("'")==1) temp=temp.Delete(1,1);
     if (temp.Find("'")==0) temp.Delete(0,1);
//if (temp.AnsiPos("'")==temp.Length())  temp=temp.Delete(temp.Length(),1);
     if (temp.Find("'")==(temp.GetLength()-1)) 
		 temp.Delete(temp.GetLength()-1,1);
     temp=ClearChar(temp,"\\");
     temp=ClearChar(temp,'\n');
     return temp;
}

//---------------
CString  TAnalyseLink::ClearChar(CString temp,CString cc)
{
   int pos,len=cc.GetLength();
   while (1) {
       pos=temp.Find(cc);      //pos=temp.AnsiPos(cc);
       if (pos!=-1)            // if (pos!=0)
           temp.Delete(pos,len);        // temp=temp.Delete(pos,len);
       else break;
   }
   return temp;

}

void  TAnalyseLink::Copy(TUrlCharacter temp)
{
   FUrlCharacter.UrlName=temp.UrlName;
   FUrlCharacter.BaseUrl=temp.BaseUrl;
   FUrlCharacter.BaseLink=temp.BaseLink;
   FUrlCharacter.InfoStyle=temp.InfoStyle;
   FUrlCharacter.LinkFilter=temp.LinkFilter;
   FUrlCharacter.TitleFilter=temp.TitleFilter;
   FUrlCharacter.ClearString=temp.ClearString;
   FUrlCharacter.VerifyDate=temp.VerifyDate;
   FUrlCharacter.StartPos=temp.StartPos;
   FUrlCharacter.FinishPos=temp.FinishPos;
   FUrlCharacter.SearchKey=temp.SearchKey;
}

/*bool  TAnalyseLink::IsVidHtmlBody(CString temp, CString tempbody)
{
   CString fs,tempFilter=InfoFilter,link=temp;
   int pos=0;
   fs=FUrlCharacter.TitleFilter;
   pos=temp.AnsiPos("href=");
   link=LinkAndTitle(link.Delete(1,pos-1),tempbody,false) ;
   if (link.AnsiPos("Already Exist")!=0) return true;
   if (link.IsEmpty())        return false;
   if (!fs.IsEmpty()&&fs[1]=='&') {
       fs=fs.Delete(1,1);
       fs=NewsDate.FormatString(fs.c_str());
       if (temp.AnsiPos(fs)==0) return false;
   }
   fs=FUrlCharacter.TitleFilter;
   if (!tempFilter.IsEmpty())  {
       int pos=tempFilter.AnsiPos("&");
       while (1) {
           fs=tempFilter.SubString(1,pos-1);
           tempFilter=tempFilter.Delete(1,pos);
           if (temp.AnsiPos(fs)>0) break;
           pos=tempFilter.AnsiPos("&");
           if (pos==0) return false;
       }
   }
   return true;
}  */

CString  TAnalyseLink::GetBrief(CString temp)
{
   int pos1,pos2;
   CString buffer="",Tempbuffer="";
   pos1=temp.Find("<");     //pos1=temp.AnsiPos("<");
   pos2=temp.Find(">");      //pos2=temp.AnsiPos(">");
   while (1)  {
      if (pos1==-1) break;      //if (pos1==0) break;
      if ((pos2==-1)&&(pos1>-1))  {         //if ((pos2==0)&&(pos1>0))
          pos2=temp.GetLength();
//          temp.Delete(pos1-1,pos2-pos1+1);   //temp=temp.Delete(pos1,pos2-pos1+1);
//          temp.Delete(pos1,pos2-pos1+1);   //temp=temp.Delete(pos1,pos2-pos1+1);
          temp.Delete(pos1,pos2-pos1);   //temp=temp.Delete(pos1,pos2-pos1+1);
          break;
      }
      else if (pos2>pos1)   {
          temp.Delete(pos1,pos2-pos1+1) ;   //temp=temp.Delete(pos1,pos2-pos1+1) ;
//          temp.Insert(pos1-1," ");    //temp.Insert(" ",pos1);
      }
      // else if ((pos1>0)&&(pos2>0)&&(pos1>pos2)) {
      else if ((pos1>-1)&&(pos2>-1)&&(pos1>pos2)) {
           Tempbuffer=temp.Mid(0,pos2+1);  // Tempbuffer=temp.SubString(1,pos2);
           buffer=buffer+Tempbuffer;
           temp.Delete(0,pos2+1);     // temp=temp.Delete(1,pos2);
      }
      pos1=temp.Find("<");       //pos1=temp.AnsiPos("<");
      pos2=temp.Find(">");        //pos2=temp.AnsiPos(">");
   }
   temp=buffer+temp ;
   temp=ClearChar(temp,"&");
   temp=ClearChar(temp,"nbsp");
   temp=ClearChar(temp,"Nbsp");
   temp=ClearChar(temp,"NBSP");
   temp=ClearChar(temp,'\n');
   temp=ClearChar(temp,'\r');
   temp=ClearChar(temp,'\t');
   temp=ClearChar(temp,';');
   temp=ClearChar(temp,"【");
   temp=ClearChar(temp,"】");
   while (1) {
       pos1=temp.Find("   ");        //pos1=temp.AnsiPos("   ");
       if (pos1==-1) break;             // if (pos1==0) break;
       temp.Delete(pos1,1);        //temp=temp.Delete(pos1,1);
   }

   if(temp.Find("简介") == 0)
	   temp.Delete(0,3);
   return  temp;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -