Function: string-suffix-p
string-suffix-p is a byte-compiled function defined in subr.el.gz.
Signature
(string-suffix-p SUFFIX STRING &optional IGNORE-CASE)
Documentation
Return non-nil if STRING ends with SUFFIX.
SUFFIX should be a string; the function returns non-nil if the characters at end of STRING compare equal with SUFFIX. If IGNORE-CASE is non-nil, the comparison is done without paying attention to letter-case differences.
Other relevant functions are documented in the string group.
Probably introduced at or before Emacs version 24.4.
Shortdoc
;; string
(string-suffix-p "bar" "foobar")
=> t
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun string-suffix-p (suffix string &optional ignore-case)
"Return non-nil if STRING ends with SUFFIX.
SUFFIX should be a string; the function returns non-nil if the
characters at end of STRING compare equal with SUFFIX.
If IGNORE-CASE is non-nil, the comparison is done without paying
attention to letter-case differences."
(declare (side-effect-free t))
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)
(eq t (compare-strings suffix nil nil
string start-pos nil ignore-case)))))