Mega Code Archive

 
Categories / Delphi / Strings
 

Extract the filename of an url

function ExtractUrlFileName(const AUrl: string): string; var i: Integer; begin i := LastDelimiter('/', AUrl); Result := Copy(AUrl, i + 1, Length(AUrl) - (i)); end; procedure TForm1.Button1Click(Sender: TObject); var s: string; begin s := ExtractUrlFileName('http://www.delphimania.de/index.php'); ShowMessage(s); //index.php end