1
0
Fork 0
cl-sites/novaspec.org/cl/f_char-name.html
2025-02-05 18:52:26 +01:00

429 lines
No EOL
8.2 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>char-name | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_char-name.html"
><LINK REL="next" HREF="f_name-char.html" TYPE="text/html" TITLE="name-char"
><LINK REL="prev" HREF="v_char-code-limit.html" TYPE="text/html" TITLE="char-code-limit"
><LINK REL="up" HREF="13_2_Characters_Dictionary.html" TYPE="text/html" TITLE="13.2 Characters Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="13_Characters.html"
>13. Characters</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="13_2_Characters_Dictionary.html"
>13.2 Characters Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_char-name.html"
>char-name</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="v_char-code-limit.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_name-char.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="char-name"
></SPAN
><B
>char-name</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>char-name</B
> <SPAN CLASS="cmssi"
>character</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="cmssi"
>name</SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>character</VAR
> &#8212; a <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>character</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>name</VAR
> &#8212; a <A HREF="26_1_Glossary.html#string"
><EM CLASS="term"
>string</EM
></A
> or <SPAN CLASS="misc"
><B
>nil</B
></SPAN
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>Returns a <A HREF="26_1_Glossary.html#string"
><EM CLASS="term"
>string</EM
></A
> that is the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of the <VAR CLASS="param"
>character</VAR
>, or <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> if the <VAR CLASS="param"
>character</VAR
> has no <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>. </P
><P CLASS="j"
>All <A HREF="26_1_Glossary.html#non-graphic"
><EM CLASS="term"
>non-graphic</EM
></A
> characters are required to have <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> unless they have some <A HREF="26_1_Glossary.html#implementation-defined"
><EM CLASS="term"
>implementation-defined</EM
></A
> <A HREF="26_1_Glossary.html#attribute"
><EM CLASS="term"
>attribute</EM
></A
> which is not <A HREF="26_1_Glossary.html#null"
><EM CLASS="term"
>null</EM
></A
>. Whether or not other <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>characters</EM
></A
> have <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> is <A HREF="26_1_Glossary.html#implementation-dependent"
><EM CLASS="term"
>implementation-dependent</EM
></A
>. </P
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#standard_character"
><EM CLASS="term"
>standard characters</EM
></A
> &#10216;<I
>Newline</I
>&#10217; and &#10216;<I
>Space</I
>&#10217; have the respective names <CODE CLASS="f"
>"Newline"</CODE
> and <CODE CLASS="f"
>"Space"</CODE
>. The <A HREF="26_1_Glossary.html#semi-standard"
><EM CLASS="term"
>semi-standard</EM
></A
> <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>characters</EM
></A
> &#10216;<I
>Tab</I
>&#10217;, &#10216;<I
>Page</I
>&#10217;, &#10216;<I
>Rubout</I
>&#10217;, &#10216;<I
>Linefeed</I
>&#10217;, &#10216;<I
>Return</I
>&#10217;, and &#10216;<I
>Backspace</I
>&#10217; (if they are supported by the <A HREF="26_1_Glossary.html#implementation"
><EM CLASS="term"
>implementation</EM
></A
>) have the respective names <CODE CLASS="f"
>"Tab"</CODE
>, <CODE CLASS="f"
>"Page"</CODE
>, <CODE CLASS="f"
>"Rubout"</CODE
>, <CODE CLASS="f"
>"Linefeed"</CODE
>, <CODE CLASS="f"
>"Return"</CODE
>, and <CODE CLASS="f"
>"Backspace"</CODE
> (in the indicated case, even though name lookup by &#8220;<CODE CLASS="f"
>#\</CODE
>&#8221; and by the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> <A HREF="f_name-char.html" CLASS="funref"
><B
>name-char</B
></A
> is not case sensitive).</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
> (char-name #\ ) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> "Space"
(char-name #\Space) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> "Space"
(char-name #\Page) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> "Page"
(char-name #\a)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "LOWERCASE-a"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "Small-A"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "LA01"
(char-name #\A)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "UPPERCASE-A"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "Capital-A"
<SPAN CLASS="sp"
><SPAN CLASS="arrow withabove"
><SPAN CLASS="above"
>or </SPAN
>&#8594;</SPAN
></SPAN
> "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"))))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> "#\\A"</PRE
></DD
><DT
><B
>Exceptional Situations</B
></DT
><DD
><P CLASS="j"
>Should signal an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_type-error.html" CLASS="typeref"
><B
>type-error</B
></A
> if <VAR CLASS="param"
>character</VAR
> is not a <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>character</EM
></A
>.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_name-char.html" CLASS="funref"
><B
>name-char</B
></A
>, <A HREF="22_1_The_Lisp_Printer.html#sec_22_1_3_2" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>22.1.3.2</SPAN
> <SPAN CLASS="cmr"
>(Printing</SPAN
> <SPAN CLASS="cmr"
>Characters)</SPAN
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><P CLASS="j"
><A HREF="26_1_Glossary.html#non-graphic"
><EM CLASS="term"
>Non-graphic</EM
></A
> <A HREF="26_1_Glossary.html#character"
><EM CLASS="term"
>characters</EM
></A
> having <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>names</EM
></A
> are written by the <A HREF="26_1_Glossary.html#Lisp_printer"
><EM CLASS="term"
>Lisp printer</EM
></A
> as &#8220;<CODE CLASS="f"
>#\</CODE
>&#8221; followed by the their <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
>; see <A HREF="22_1_The_Lisp_Printer.html#sec_22_1_3_2" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>22.1.3.2</SPAN
> <SPAN CLASS="cmr"
>(Printing</SPAN
> <SPAN CLASS="cmr"
>Characters)</SPAN
></A
>.</P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="v_char-code-limit.html" CLASS="prev"
>&#8592;</A
><A HREF="f_name-char.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>