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 xe 提示没有定义decimalseparator等的解决方法

Delphi截取字符串

Delphi编程获取系统当前进程、窗口句柄、文件属性

pascal 语言中的关键字及保留字

Delphi “invalid floating point operation.”错误的解决方法

Delphi 结束360safe和360保险箱进程

Delphi 生成txt 指定带bom

Delphi之木马生成原理(资源文件,和文件流的应用)

Delphi httpencode

Delphi idhttp1 获取网页代码

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



打赏

取消

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

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

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

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

评论

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