本文整理自网络,侵删。
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 xe5 android 调用 google zxing
Delphi ini文件操作 tinifile、tmeminifile
更多相关阅读请进入《Delphi》频道 >>