diff lisp/subr.el @ 106232:f44541b1d13c

(string-prefix-p): New function.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 Nov 2009 03:59:19 +0000
parents e411fa8e0abf
children 1d1d5d9bd884
line wrap: on
line diff
--- a/lisp/subr.el	Wed Nov 25 03:51:00 2009 +0000
+++ b/lisp/subr.el	Wed Nov 25 03:59:19 2009 +0000
@@ -3193,6 +3193,13 @@
       (setq matches (cons (substring string start l) matches)) ; leftover
       (apply #'concat (nreverse matches)))))
 
+(defun string-prefix-p (str1 str2 &optional ignore-case)
+  "Return non-nil if STR1 is a prefix of STR2.
+If IGNORE-CASE is non-nil, the comparison is done without paying attention
+to case differences."
+  (eq t (compare-strings str1 nil nil
+                         str2 0 (length str1) ignore-case)))
+
 ;;;; invisibility specs
 
 (defun add-to-invisibility-spec (element)