Check if a string ends with a suffix in Emacs Lisp
问题 Is there a function that checks that a string ends with a certain substring? Python has endswith: >>> "victory".endswith("tory") True 回答1: Just install s.el string manipulation library and use its s-suffix? predicate: (s-suffix? "turn." "...when it ain't your turn.") ; => t But if you refuse you to use this library, you have to write your own function. There is string-prefix-p, which is an analog to Python's str.startswith, in subr.el , and it is just a wrapper around compare-strings.