1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

; * lisp/subr.el (string-suffix-p, string-prefix-p): Doc fix.

This commit is contained in:
Eli Zaretskii 2023-09-14 16:08:54 +03:00
parent 809305e6d8
commit 5ec8be1d58

View File

@ -5494,9 +5494,11 @@ See also `string-equal'."
(eq t (compare-strings string1 0 nil string2 0 nil t)))
(defun string-prefix-p (prefix string &optional ignore-case)
"Return non-nil if PREFIX is a prefix of STRING.
"Return non-nil if STRING begins with PREFIX.
PREFIX should be a string; the function returns non-nil if the
characters at the beginning of STRING compare equal with PREFIX.
If IGNORE-CASE is non-nil, the comparison is done without paying attention
to case differences."
to letter-case differences."
(declare (pure t) (side-effect-free t))
(let ((prefix-length (length prefix)))
(if (> prefix-length (length string)) nil
@ -5504,9 +5506,11 @@ to case differences."
0 prefix-length ignore-case)))))
(defun string-suffix-p (suffix string &optional ignore-case)
"Return non-nil if SUFFIX is a suffix of STRING.
"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 case differences."
attention to letter-case differences."
(declare (pure t) (side-effect-free t))
(let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0)