Appearance
ExtractFileExt
Declaration
Function ExtractFileExt( const FileName : string) : string
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := ExtractFileExt(Source.FileCon.CurrentFilename);
end;Description
Returns the file name extension of a file path. The input parameter can either be just a filename or a complete file path.
The extension is considered to be anything that includes and follows the rightmost '.' in a file name. The case of each character is not changed.
Therefore:
- ExtractFileExt('abc.txt') returns '.txt'
- ExtractFileExt('abc') returns '', because no '.' in the file name
- ExtractFileExt('abc.') returns '.'
- ExtractFileExt('abc...') returns '.'
- ExtractFileExt('abc.ref1.txt') returns '.txt'
- ExtractFileExt('abc.TXT') returns '.TXT'