System.IOUtils.TPath.ChangeExtension
Delphi
class function ChangeExtension(const Path, Extension: string): string; static;
C++
static System::UnicodeString __fastcall ChangeExtension(const System::UnicodeString Path, const System::UnicodeString Extension);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | TPath |
Description
Changes the extension of a file or directory indicated by the given path.
ChangeExtension takes the given file or directory name passed in the Path parameter and changes its extension to the extension passed in the Extension parameter. The new specified extension can include the initial period. ChangeExtension does not rename the actual file, it just creates a new file name string.
The following table lists the parameters expected by this method:
Name | Meaning |
---|---|
Path |
The file or directory path for which the extension is changed. |
Extension |
The new extension applied to the given path. |
Note: ChangeExtension raises an exception if the given path or extension contain invalid characters.
See Also
Code Examples