我用idhttp获取网页代码,保存到一个字符串变量中,然后要做一个过滤已知过滤的头尾两个内容如: <div id="aaaaa"  /  </p></div><div>如何获取其中的代码?其实就是一个页面的网页采集下来了,如何进行处理?希望有详细的代码谢谢!!!!另,采集的页面有时候会有?号(正确情况应为中文),怎么办?

解决方案 »

  1.   

    最好的办法是用 正则表达式了最方便的是用 Pos() 了
      

  2.   

    pos和正则都可TRegExpr正则表达式
    http://hi.baidu.com/program8/blog/item/31800b0801b32030e824885f.html
      

  3.   


    while  pos('',yourGatheredStr) >0  then
    begin
       yourNeededContext := copy(yourGatheredStr,
                            pos('startWith',yourGatheredStr) ,
                            pos('endWIth'yourGatheredStr) );
        doProcess;
        delete(yourGatheredStr,1,pos('endWIth'yourGatheredStr) );end;
      

  4.   

    唉,delphi做这个真难受呀,只好用c#了