views:

194

answers:

2

I'm developing a program that needs to parse the file name into a TTextField. How to remove the file extension I've already know(or think that I can do like this):

var
  FName: String;
  FPath: String;

begin
  FPath := OpenDialog1.FileName;
  FName := ChangeFileExt(FPath, '');
end;

But how can I remove the file path from FName?

+5  A: 

Take a look at SysUtils.ExtractFileName. I think that's what you're looking for.

Mason Wheeler
+13  A: 

Just add ExtractFileName(FName);

fupsduck