全部。我想知道 Emacs lisp 是否具有用于检查字符串是否完全由大写字符组成的内置函数。这是我现在正在使用的:
(setq capital-letters (string-to-list "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
(defun chars-are-capitalized (list-of-characters)
"Returns true if every character in a list of characters is a capital
letter. As a special case, the empty list returns true."
(cond
((equal list-of-characters nil) t)
((not (member (car list-of-characters) capital-letters)) nil)
(t (chars-are-capitalized (cdr list-of-characters)))))
(defun string-is-capitalized (string)
"Returns true if every character in a string is a capital letter. The
empty string returns true."
(chars-are-capitalized (string-to-list string)))
它工作正常(尽管它依赖于我只会使用 ASCII 字符的假设),但我想知道我是否遗漏了一些我应该知道的明显功能。