aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2023-09-14 16:08:54 +0300
committerEli Zaretskii2023-09-14 16:08:54 +0300
commit5ec8be1d58922eb7af95f720882dbb56410129d4 (patch)
tree36c6ff23e5cb77ebd45176c04430994df20f0a0f
parent809305e6d8fb2489b86a1fbf850f88d17a7864f0 (diff)
downloademacs-5ec8be1d58922eb7af95f720882dbb56410129d4.tar.gz
emacs-5ec8be1d58922eb7af95f720882dbb56410129d4.zip
; * lisp/subr.el (string-suffix-p, string-prefix-p): Doc fix.
-rw-r--r--lisp/subr.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index ce23a699624..426e8145cae 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -5494,9 +5494,11 @@ See also `string-equal'."
5494 (eq t (compare-strings string1 0 nil string2 0 nil t))) 5494 (eq t (compare-strings string1 0 nil string2 0 nil t)))
5495 5495
5496(defun string-prefix-p (prefix string &optional ignore-case) 5496(defun string-prefix-p (prefix string &optional ignore-case)
5497 "Return non-nil if PREFIX is a prefix of STRING. 5497 "Return non-nil if STRING begins with PREFIX.
5498PREFIX should be a string; the function returns non-nil if the
5499characters at the beginning of STRING compare equal with PREFIX.
5498If IGNORE-CASE is non-nil, the comparison is done without paying attention 5500If IGNORE-CASE is non-nil, the comparison is done without paying attention
5499to case differences." 5501to letter-case differences."
5500 (declare (pure t) (side-effect-free t)) 5502 (declare (pure t) (side-effect-free t))
5501 (let ((prefix-length (length prefix))) 5503 (let ((prefix-length (length prefix)))
5502 (if (> prefix-length (length string)) nil 5504 (if (> prefix-length (length string)) nil
@@ -5504,9 +5506,11 @@ to case differences."
5504 0 prefix-length ignore-case))))) 5506 0 prefix-length ignore-case)))))
5505 5507
5506(defun string-suffix-p (suffix string &optional ignore-case) 5508(defun string-suffix-p (suffix string &optional ignore-case)
5507 "Return non-nil if SUFFIX is a suffix of STRING. 5509 "Return non-nil if STRING ends with SUFFIX.
5510SUFFIX should be a string; the function returns non-nil if the
5511characters at end of STRING compare equal with SUFFIX.
5508If IGNORE-CASE is non-nil, the comparison is done without paying 5512If IGNORE-CASE is non-nil, the comparison is done without paying
5509attention to case differences." 5513attention to letter-case differences."
5510 (declare (pure t) (side-effect-free t)) 5514 (declare (pure t) (side-effect-free t))
5511 (let ((start-pos (- (length string) (length suffix)))) 5515 (let ((start-pos (- (length string) (length suffix))))
5512 (and (>= start-pos 0) 5516 (and (>= start-pos 0)