本文整理自网络,侵删。
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);beginmemo1.Text:=ExtractPathURLToCompleteURL('http://www.delphitop.com'); //结果 http://end;
相关阅读 >>
Delphi 从paintbox拷贝一部分内容到tbitmap
Delphi firedac 下的 sqlite 创建数据库
更多相关阅读请进入《Delphi》频道 >>