Check if a string is all-caps in Emacs lisp? -


all. I was wondering if Imax Lispi has a function that checks whether a string is completely out of capitalized characters or not. Here's what I'm using now:

  (set-capitalist-letter-string-to-list "ABCDEFGJKLMOPCRSTWVX")) (DUUPP-R-Capitol (return) If there is a capital letter in the list of characters, each letter is a capital letter. In the form of a special case, the empty list returns are correct. "(Bracket ((same list-letter zero) T ((no member (car list (characters) Letter-of-ak () "(Defun string-capitalized (string)" really gives if a string is a capital letter in each character, an empty string return is correct. "(Letter-by-capital (string-to-list) It works fine (though it depends on the assumption that I will only use ASCII characters), but I was wondering if I remember some explicit function I am coming to know   

In the context of other answers:

  1. Use of your is not is a good idea: it will allocate a new string, it will not be found that the string has non-alphabet characters (it seems that you It's better to use string-match , and

  2. As all of these problems solve tray shows, you need to do this when EX-fold-search is zero otherwise Alex can treat it as a case-insensitive search but string-match-p is better because it Match data avoids changing. (Emacs keeps the data after any match, and if you use string-match , you'll overwrite it, which can break the code using your function.) < Another issue is regexp, using "^ ... $" means that Emacs will see some line with some matching content. - And if you have newline characters in your string, then it can return a bogus result you can get backslash-descend and backslash-ud Chevron will use the match from the beginning of the string and the end.

Then there is a correct version:

  (defun string-is-capitalized (str) (let ((case-fold-search noil)) ( String-match-P "\\` [AZ] * \\ '"str))  

( -p in general relation in BTW, AMX Lisp For predicates, use it as string-capitalized-p .)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -