char-name
char-name character → name
character—a character.
Returns a string that is the name of the character, or nil if the character has no name.
13.4.0 20 \funref{char-name} will only locate ``simple'' character names; it will not construct names on the basis of the \param{character}'s \term{implementation-dependent} \term{attributes}.
All non-graphic characters are required to have names unless they have some implementation-defined attribute which is not null. Whether or not other characters have names is implementation-dependent.
I added this next phrase to highlight why there are two lists here. -kmp 14-May-93The standard characters ⟨Newline⟩ and ⟨Space⟩ have the respective names "Newline" and "Space". Ditto. -kmp 14-May-93The semi-standard characters ⟨Tab⟩, ⟨Page⟩, ⟨Rubout⟩, ⟨Linefeed⟩, ⟨Return⟩, and ⟨Backspace⟩ Next parenthetical remark added for emphasis. -kmp 14-May-93(if they are supported by the implementation) have the respective names "Tab", "Page", "Rubout", "Linefeed", "Return", and "Backspace" (in the indicated case, even though name lookup by “#\” and by the function name-char is not case sensitive).
(char-name #\ ) → "Space" (char-name #\Space) → "Space" (char-name #\Page) → "Page" (char-name #\a) → NIL OR→ "LOWERCASE-a" OR→ "Small-A" OR→ "LA01" (char-name #\A) → NIL OR→ "UPPERCASE-A" OR→ "Capital-A" OR→ "LA02" ;; Even though its CHAR-NAME can vary, #\A prints as #\A (prin1-to-string (read-from-string (format nil "#\\~A" (or (char-name #\A) "A")))) → "#\\A"
None.
Should signal an error of type type-error if character is not a character.
name-char, Section 22.1.3.2 (Printing Characters)
Added "non-graphic" to cover objection by Sandra:
Does this mean that if (char-name #\A) = "Capital-A"
(print #\A) prints
#\Capital-A
instead of #\A ???
Or does this apply only to non-standard characters.Non-graphic characters having names are written by the Lisp printer as “#\” followed by the their name; see Section 22.1.3.2 (Printing Characters).