If character is a lowercase character, char-upcase returns the corresponding uppercase character. Otherwise, char-upcase just returns the given character.
If character is an uppercase character, char-downcase returns the corresponding lowercase character. Otherwise, char-downcase just returns the given character.
The result only ever differs from character in its code attribute; all implementation-defined attributes are preserved.
(char-upcase #\a)
→#\A
(char-upcase #\A)
→#\A
(char-downcase #\a)
→#\a
(char-downcase #\A)
→#\a
(char-upcase #\9)
→#\9
(char-downcase #\9)
→#\9
(char-upcase #\@)
→#\@
(char-downcase #\@)
→#\@
Note that this next example might run for a very long time in some implementations if char-code-limit happens to be very large for that implementation.
(dotimes (code char-code-limit) (let ((char (code-char code))) (when char (unless (cond ((upper-case-p char) (char= (char-upcase (char-downcase char)) char)) ((lower-case-p char) (char= (char-downcase (char-upcase char)) char)) (t (and (char= (char-upcase (char-downcase char)) char) (char= (char-downcase (char-upcase char)) char)))) (return char)))))
→NIL ;; TODO fix, does not return NIL on SBCL, ECL or CMUCL
None.
Should signal an error of type type-error if character is not a character.
Function UPPER-CASE-P, Function ALPHA-CHAR-P, {\secref\CharactersWithCase}, {\secref\ImplementationDefinedScripts}
If the corresponding-char is different than character, then both the character and the corresponding-char have case.
Since char-equal ignores the case of the characters it compares, the corresponding-character is always the same as character under char-equal.
\issue{CHARACTER-PROPOSAL:2-1-1}