Appearance
ExtractFileName
Returns the file name portion of a file path, including the file extension. Any directory information is stripped away.
Declaration: Function ExtractFileName( const FileName : string) : string
An example follows.
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := ExtractFileName(Source.FileCon.CurrentFilename);
end;The following shows further examples.
pascal
procedure ScriptEvent (var Value : variant);
var
f: string;
begin
LogInfo('');
f := 'abc.exe'; LogInfo('ExtractFileName(''' + f + ''') -> ''' + ExtractFileName(f) + '''');
f := 'abc.ref2.txt'; LogInfo('ExtractFileName(''' + f + ''') -> ''' + ExtractFileName(f) + '''');
f := 'C:\MyData\abcdefg.txt'; LogInfo('ExtractFileName(''' + f + ''') -> ''' + ExtractFileName(f) + '''');
f := 'TheActualFile.xlsx'; LogInfo('ExtractFileName(''' + f + ''') -> ''' + ExtractFileName(f) + '''');
LogInfo('');
LogInfo('');
end;And the resulting log entries that are generated.


