file-extension | ||
---|---|---|
Prev | 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, <ndw@nwalsh.com>
(define (file-extension filespec) ;; Return the extension of a filename (if (string? filespec) (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 |