emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115208: * lisp/subr.el (string-suffix-p): New funct


From: Bozhidar Batsov
Subject: [Emacs-diffs] trunk r115208: * lisp/subr.el (string-suffix-p): New function.
Date: Sun, 24 Nov 2013 08:52:13 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115208
revision-id: address@hidden
parent: address@hidden
committer: Bozhidar Batsov <address@hidden>
branch nick: master
timestamp: Sun 2013-11-24 10:49:44 +0200
message:
  * lisp/subr.el (string-suffix-p): New function.
modified:
  etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/subr.el                   subr.el-20091113204419-o5vbwnq5f7feedwu-151
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-11-23 19:07:34 +0000
+++ b/etc/NEWS  2013-11-24 08:49:44 +0000
@@ -790,6 +790,8 @@
 The value, if non-nil, is a regexp that specifies what to trim from
 the start and end of each substring.
 
+** New function `string-suffix-p'.
+
 ** `get-upcase-table' is obsoleted by the new `case-table-get-table'.
 
 ** Support for filesystem notifications.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-23 19:39:50 +0000
+++ b/lisp/ChangeLog    2013-11-24 08:49:44 +0000
@@ -1,3 +1,7 @@
+2013-11-24  Bozhidar Batsov  <address@hidden>
+
+       * subr.el (string-suffix-p): New function.
+
 2013-11-23  Glenn Morris  <address@hidden>
 
        * progmodes/python.el (python-shell-send-file):

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-11-15 10:02:13 +0000
+++ b/lisp/subr.el      2013-11-24 08:49:44 +0000
@@ -3635,6 +3635,15 @@
   (eq t (compare-strings str1 nil nil
                          str2 0 (length str1) ignore-case)))
 
+(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)))))
+
 (defun bidi-string-mark-left-to-right (str)
   "Return a string that can be safely inserted in left-to-right text.
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]