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 SUFFIX is a suffix of STRING.

If IGNORE-CASE is non-nil, the comparison is done without paying attention to 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 SUFFIX is a suffix of STRING.
If IGNORE-CASE is non-nil, the comparison is done without paying
attention to case differences."
  (let ((start-pos (- (length string) (length suffix))))
    (and (>= start-pos 0)
         (eq t (compare-strings suffix nil nil
                                string start-pos nil ignore-case)))))