file-name-extension

file-name-extension is a compiled Lisp function in `files.el'.

(file-name-extension FILENAME &optional PERIOD)

Return FILENAME's final "extension".
The extension, in a file name, is the part that follows the last `.',
excluding version numbers and backup suffixes,
except that a leading `.', if any, doesn't count.
Return nil for extensionless file names such as `foo'.
Return the empty string for file names such as `foo.'.

If PERIOD is non-nil, then the returned value includes the period
that delimits the extension, and if FILENAME has no extension,
the value is "".