# get_file_extension

Definition: | string extension = get_file_extension(string filename)
Description: | Extract the file extension portion of a file name. filename: the [path and] filename from which to extract information. Returns a string, the lower-case extension part of filename.
pwa/p2js: | Supported (after all it is only a bit of text extraction).
Comments: | Automatically strips linux-style trailing version numbers, ie treats say "libglfw.so.3.1" as "libglfw.so" (both yeilding "so"), however "file.1" ==> "1", and "test.r01" -> "r01". Both forwardslash ('/') and backslash ('\\') are handled for all platforms. Unlike get_file_base() and get_file_name(), the result is always lower-case, even if the actual filename is not.
Example: |
    ?get_file_name("C:/Program Files (x86)/Phix/test.txt")  -- displays "txt"
    ?get_file_name("TEST.TXT")                         -- also displays "txt"
Implementation: | See builtins\file_utils.e (an autoinclude) for details of the actual implementation.
See Also: | get_file_base, get_file_name
Technicalia | For compatibility with Euphoria, fileext() is a simple alias of get_file_extension(), and behaves identically.