- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
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);
begin
showmessage(GetHost('http://www.3464.com/tools/'));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
url:='http://www.3464.com/tools/index.htm';
showmessage(GetURI());
end;