高手帮忙...比如:http://www.xxx.com/htm/index.html中,如何取得http://www.xxx.com/
谢了,在线等......

解决方案 »

  1.   

    不就是第一个'/'前面的字符串吗
    取出来就是了
    用copy() pos()
      

  2.   

    请问楼上.copy()中取到第3个/的位置时,怎么写?谢了
      

  3.   

    不好意思
    看错了
    procedure TForm1.Button1Click(Sender: TObject);
    var
     s:string;begin
       s := 'http://www.xxx.com/htm/index.html';
       delete(s,1,pos('//',s)+1);   //showmessage(s);
        s:=copy(s,1,pos('/',s)-1);
        s := 'http://'+s;
      showmessage(s);
    end;