Skip to main content

ExtractFileName

Structure

ExtractFileName(sFileName: Text): Text

Type

Function

Description

This function will extract the filename and extension from a full path that includes directory+file name+extension. Basically this function will start reading from right to left and assemble the function result until it reaches either a '' or '/' character.

Parameters

sFileName = the name of the full directory+file name+extension

Return value

Text

Examples

ShowMessage(ExtractFileName('C:\test\subdir\MyFile.PDF'))
ShowMessage(ExtractFileName('http://mywebserver.com/somedir/MyFile.PDF'))

```pascal
' both would show: 'MyFile.PDF'