Delphi中提取网址链接分路径

 function GetHost(TheURL: string): String;  var    FURL: String;  begin 
  FURL := TheURL + ‘555’;    if pos(UpperCase(‘http://’),
UpperCase(FURL)) > 0 then    begin      Delete(FURL, 1,
Length(‘http://’),’,’,’);    end;    Result := Copy(FURL, 1, pos(‘/’,
FURL) – 1,’,’,’);  end;
  function GetURI():string;  var    s:String;  begin    S:=GetHost(URL)
;    Result := Copy(URL, pos(s, URL) + Length(s) + 1, MaxInt,’,’,’); 
end;

procedure TForm1.Button1Click(Sender:
TObject,’,’,’);beginshowmessage(GetHost(‘;
procedure TForm1.Button2Click(Sender:
TObject,’,’,’);beginurl:=’),’,’,’);
end;

发表评论

电子邮件地址不会被公开。 必填项已用*标注