comp • gb • file • ext

File.Ext (gb)

Static Function Ext ( Path As String ) As String

Returns the extension of a file name.

This example will display information about a file path selected by the user. It uses the methods File.Name, File.BaseName, File.Ext and File.Dir.


Public Sub ButtonDisplayPath_Click()
  If Dialog.OpenFile() Then Return
  Print "Full file path: " & Dialog.Path
  Print "File name (with extension): " & File.Name(Dialog.Path)
  Print "File name (without extension): " & File.BaseName(Dialog.Path)
  Print "File extension: " & File.Ext(Dialog.Path)
  Print "Directory of the file: " & File.Dir(Dialog.Path)