| The Modular DocBook Stylesheets | ||
|---|---|---|
| Prev | DSSSL Library | Next |
(file-extension filespec)
Returns the extension of a filename. The extension is the last "."-delimited part of the name. Returns "" if there is no period in the filename.
Norman Walsh, <norm@berkshire.net>
(define (file-extension filespec)
;; Return the extension of a filename
(let* ((pathparts (match-split filespec "/"))
(filename (list-ref pathparts (- (length pathparts) 1)))
(fileparts (match-split filename "."))
(extension (list-ref fileparts (- (length fileparts) 1))))
(if (> (length fileparts) 1)
extension
"")))| Prev | Home | Next |
| expt | Up | find-first-char |
Copyright © 1997, 1998 Norman Walsh