diff options
author | Bozhidar Batsov <bozhidar@batsov.com> | 2013-11-24 10:49:44 +0200 |
---|---|---|
committer | Bozhidar Batsov <bozhidar@batsov.com> | 2013-11-24 10:49:44 +0200 |
commit | 41ce6f702730d95ef62e770a1b8160e3aac9d0a8 (patch) | |
tree | 0dcbafeb865b63463ae26353aa92ad4b4954a73c /lisp/subr.el | |
parent | 0b09f7c0d338d8c527212a5397ddf52b58c2cbe2 (diff) | |
download | emacs-41ce6f702730d95ef62e770a1b8160e3aac9d0a8.tar.gz |
* lisp/subr.el (string-suffix-p): New function.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 31798b44849..b22c719f010 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3635,6 +3635,15 @@ to case differences." (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. |