FileExtension

Returns the extension of a file.

Syntax:

FileExtension (filename)

Parameters:

(s) filename [optional path]full file name, including extension.

Returns:

(s) file extension.

 

This function parses the passed filename and returns the extension part of the filename.

Example:


; prevent the user from editing a COM or EXE file
allfiles = FileItemize("*.*")
editfile = AskItemlist("Select file to edit", allfiles, @TAB, @UNSORTED, @SINGLE, @FALSE)
ext = FileExtension(editfile)
If (ext == "COM") || (ext == "EXE")
   Message ("Sorry", "You may not edit a program file")
Else
   DirChange(DirWindows(0))
   Run("notepad.exe", editfile)
EndIf
See Also:

Dialog, FilePath, FileRoot, FileBaseName