Split a filename into its basename and extension.
(vl-split-filename filename) → (mv basename extension)
Function:
(defun vl-split-filename (filename) (declare (xargs :guard (stringp filename))) (let ((__function__ 'vl-split-filename)) (declare (ignorable __function__)) (b* ((filename (string-fix filename)) (pos (str::strrpos "." filename)) ((unless pos) (mv filename nil)) (basename (subseq filename 0 pos)) (extension (subseq filename (+ 1 pos) nil))) (mv basename extension))))
Theorem:
(defthm stringp-of-vl-split-filename.basename (b* (((mv ?basename ?extension) (vl-split-filename filename))) (stringp basename)) :rule-classes :type-prescription)
Theorem:
(defthm maybe-stringp-of-vl-split-filename.extension (b* (((mv ?basename ?extension) (vl-split-filename filename))) (maybe-stringp extension)) :rule-classes :type-prescription)
Theorem:
(defthm vl-split-filename-of-str-fix-filename (equal (vl-split-filename (str-fix filename)) (vl-split-filename filename)))
Theorem:
(defthm vl-split-filename-streqv-congruence-on-filename (implies (streqv filename filename-equiv) (equal (vl-split-filename filename) (vl-split-filename filename-equiv))) :rule-classes :congruence)