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;

相关阅读 >>

Delphi 如何设置文件属性

Delphi复制文件夹内所有文件

Delphi获得系统当前时间日期和格式化时间

unigui js操作Delphi控件赋值

Delphi is 与 as 运算符举例

Delphi xe6、xe5、xe7在android创建快捷方式

Delphi 根据ip获取局域网mac

Delphi Delphi tparallel cleanup needed用法

最简单的Delphi驱动结束进程

Delphi 实现qq窗体的缩入伸出功能

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...