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 录音制作 wav 文件

Delphi jsondataobjects

Delphi 获取android package name:

Delphi {$pointermath on} 方便指针操作的编译指令

Delphi提取网页中的图片

Delphi tms web core messagedlg对话框用法

Delphi 处理图片(剪切,压缩)

Delphi 如何产生输出一个变形的图形及文字

Delphi 比较两个日期是否大于n天

Delphi 如何将颜色值转换为灰度颜色值?

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



打赏

取消

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

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

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

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

评论

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