Home  |  Delphi .net Home  |  System.IO.Path  |  GetFileNameWithoutExtension Method
GetFileNameWithoutExtension  
Method  
Gets the FileName from the specified Path string
Path Class
System.IO NameSpace
CF1.  Function GetFileNameWithoutExtension ( PathString : String; ) : String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
The GetFileNameWithoutExtension method extracts the file name from the given PathString as the return string. The file name has any extension (including prefix .), if any, removed.
Microsoft MSDN Links
System.IO
System.IO.Path
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  PathString : String;

begin
  PathString := 'C:\DelphiBasics.txt';

  Console.WriteLine('"{0}" has file name without extension "{1}"',
                    PathString,
                    System.IO.Path.GetFileNameWithoutExtension(PathString));

  Console.Readline;
end.
Show full unit code
  "C:\DelphiBasics.txt" has file name without extension "DelphiBasics"
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author