请问,在一个字符串中,如何将指定的第二个重复的值后面的字符取出?比如:Str:=http://adfarm.midiapaly.com/ck/dd.asp?mpro=http://pages.fox.com.cn/1yuan.html如何返回:
http://pages.fox.com.cn/1yuan.html

解决方案 »

  1.   

    还有如何取得一个网页的站点地址?比如:
    Str:='http://www.xxx.com/dd.htm';如何返回:
    http://www.xxx.com
      

  2.   

    简单的字符串处理,自己想一下算法就行了
    这是我写的,可以参考下
    //得到substr在SouseStr中第Index次出现的位置
    function PosEx(subStr:string;SouseStr:string;Index:integer):integer;
    var
      i:integer;
      iPos:integer;
      AStr:string;
    begin
      AStr := SouseStr;
      result := 0;
      for i := 1 to Index do
      begin
        iPos := Pos(subStr,AStr);
        if iPos = 0 then exit;
        if i = Index then
        begin
          result := length(SouseStr) - length(AStr) + iPos;
          exit;
        end;
        System.Delete(AStr,1,iPos + length(subStr) - 1);
      end;
    end;
      

  3.   

    s:=InsertQry.fieldbyname('zhong').AsString;
             for i:=1 to length(s) do begin
                 ss:=copy(s,pos(s[i],s)+1,255);
                 if pos(s[i],ss) >0 then begin
                      c:=c+1;   k:=k+1;
                      break;
                 end;
             end;