Function: cmpl-string-case-type

cmpl-string-case-type is a byte-compiled function defined in completion.el.gz.

Signature

(cmpl-string-case-type STRING)

Documentation

Return :capitalized, :up, :down, :mixed, or :neither for case of STRING.

Source Code

;; Defined in /usr/src/emacs/lisp/completion.el.gz
;;---------------------------------------------------------------------------
;; Low level tools
;;---------------------------------------------------------------------------

;;-----------------------------------------------
;; String case coercion
;;-----------------------------------------------

(defun cmpl-string-case-type (string)
  "Return :capitalized, :up, :down, :mixed, or :neither for case of STRING."
  (let ((case-fold-search nil))
    (cond ((string-match "[[:lower:]]" string)
	   (cond ((string-match "[[:upper:]]" string)
		  (cond ((and (> (length string) 1)
			      (null (string-match "[[:upper:]]" string 1)))
			 :capitalized)
			(t
			 :mixed)))
		 (t :down)))
	  (t
	   (cond ((string-match "[[:upper:]]" string)
		  :up)
		 (t :neither))))))