Delphi 获取网址链接协议头


本文整理自网络,侵删。

 
uses System.StrUtils;
function  ExtractPathURLToCompleteURL ( URL : string ) : string;
var
    Temp : string;
    Position : Integer;
begin
    if RightStr( Trim(URL) , 1) = '/' then
        Temp := URL
    else begin
        Position := Length( URL );
        if Pos( '/', URL ) <> 0 then
        begin
            while ( Copy( URL, Position, 1 ) <> '/' ) do dec( Position );
            Temp := LeftStr( URL, Position  )
        end else
            Temp := Trim( URL );
    end;
    Result := Trim(Temp);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
memo1.Text:=ExtractPathURLToCompleteURL('http://www.delphitop.com');   //结果  http://
end;

相关阅读 >>

Delphi url 中文编解码

Delphi xe5 android 调用 google zxing

Delphi xe3中如何crc验证函数?

Delphi 调用cmd命令行并取得返回结果

Delphi中move 函数额用法

Delphi adoquery 开启本地缓存

Delphi ini文件操作 tinifile、tmeminifile

Delphi 中判断windows系统是否是64位系统

Delphi实现身份证号码15到18位升位算法

Delphi将图片转换成文本支持转换回去

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



打赏

取消

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

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

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

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

评论

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