vl-filename-extension (AutoLISP)

Returns the extension from a file name, after stripping out the rest of the name

Supported Platforms: Windows and Mac OS

Signature

(vl-filename-extension filename)
filename

Type: String

File name, including the extension. The vl-filename-extension function does not check to see if the specified file exists.

Return Values

Type: String or nil

A string containing the extension of filename. The returned string starts with a period (.) and is in uppercase. If filename does not contain an extension, vl-filename-extension returns nil.

Examples

Windows
(vl-filename-extension "c:\\acadwin\\output.txt")
".txt"

(vl-filename-extension "c:\\acadwin\\output")
nil
Mac OS
(vl-filename-extension "/myutilities/support/output.txt")
".txt"

(vl-filename-extension "/myutilities/support/output")
nil