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

317 lines
No EOL
7 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>*print-case* | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="v_print-case.html"
><LINK REL="next" HREF="v_print-circle.html" TYPE="text/html" TITLE="*print-circle*"
><LINK REL="prev" HREF="v_print-base.html" TYPE="text/html" TITLE="*print-base*, *print-radix*"
><LINK REL="up" HREF="22_4_Printer_Dictionary.html" TYPE="text/html" TITLE="22.4 Printer 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="22_Printer.html"
>22. Printer</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="22_4_Printer_Dictionary.html"
>22.4 Printer Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="v_print-case.html"
>*print-case*</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="v_print-base.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="v_print-circle.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="*print-case*"
></SPAN
><SPAN CLASS="cmsy"
>*</SPAN
><B
>print-case</B
><SPAN CLASS="cmsy"
>*</SPAN
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Variable</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Value Type</B
></DT
><DD
><P CLASS="j"
>One of the <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbols</EM
></A
> <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:upcase</SPAN
></SPAN
>, <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:downcase</SPAN
></SPAN
>, or <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:capitalize</SPAN
></SPAN
>.</P
></DD
><DT
><B
>Initial Value</B
></DT
><DD
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:upcase</SPAN
></SPAN
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_print-case.html" CLASS="misc"
><B
>*print-case*</B
></A
> controls the case (upper, lower, or mixed) in which to print any uppercase characters in the names of <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbols</EM
></A
> when vertical-bar syntax is not used. </P
><P CLASS="j"
><A HREF="v_print-case.html" CLASS="varref"
><B
>*print-case*</B
></A
> has an effect at all times when the <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_print-escape.html" CLASS="misc"
><B
>*print-escape*</B
></A
> is <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>. <A HREF="v_print-case.html" CLASS="varref"
><B
>*print-case*</B
></A
> also has an effect when the <A HREF="26_1_Glossary.html#value"
><EM CLASS="term"
>value</EM
></A
> of <A HREF="v_print-escape.html" CLASS="misc"
><B
>*print-escape*</B
></A
> is <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
> unless inside an escape context (<I CLASS="i"
><I
>i.e.</I
></I
>, unless between <A HREF="26_1_Glossary.html#vertical-bar"
><EM CLASS="term"
>vertical-bars</EM
></A
> or after a <A HREF="26_1_Glossary.html#slash"
><EM CLASS="term"
>slash</EM
></A
>).</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
> (defun test-print-case ()
(dolist (*print-case* '(:upcase :downcase :capitalize))
(format t "~&amp;~S ~S~%" 'this-and-that '|And-something-elSE|)))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> TEST-PC
;; Although the choice of which characters to escape is specified by
;; *PRINT-CASE*, the choice of how to escape those characters
;; (i.e., whether single escapes or multiple escapes are used)
;; is implementation-dependent. The examples here show two of the
;; many valid ways in which escaping might appear.
(test-print-case) ;Implementation A
<SPAN CLASS="cmr"
>&#8883;</SPAN
> THIS-AND-THAT |And-something-elSE|
<SPAN CLASS="cmr"
>&#8883;</SPAN
> this-and-that a\n\d-\s\o\m\e\t\h\i\n\g-\e\lse
<SPAN CLASS="cmr"
>&#8883;</SPAN
> This-And-That A\n\d-\s\o\m\e\t\h\i\n\g-\e\lse
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL
(test-print-case) ;Implementation B
<SPAN CLASS="cmr"
>&#8883;</SPAN
> THIS-AND-THAT |And-something-elSE|
<SPAN CLASS="cmr"
>&#8883;</SPAN
> this-and-that a|nd-something-el|se
<SPAN CLASS="cmr"
>&#8883;</SPAN
> This-And-That A|nd-something-el|se
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL</PRE
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_write.html" CLASS="funref"
><B
>write</B
></A
></P
></DD
><DT
><B
>Notes</B
></DT
><DD
><P CLASS="j"
><A HREF="f_read.html" CLASS="funref"
><B
>read</B
></A
> normally converts lowercase characters appearing in <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbols</EM
></A
> to corresponding uppercase characters, so that internally print names normally contain only uppercase characters. </P
><P CLASS="j"
>If <A HREF="v_print-escape.html" CLASS="varref"
><B
>*print-escape*</B
></A
> is <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>, lowercase characters in the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> are always printed in lowercase, and are preceded by a single escape character or enclosed by multiple escape characters; uppercase characters in the <A HREF="26_1_Glossary.html#name"
><EM CLASS="term"
>name</EM
></A
> of a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> are printed in upper case, in lower case, or in mixed case so as to capitalize words, according to the value of <A HREF="v_print-case.html" CLASS="varref"
><B
>*print-case*</B
></A
>. The convention for what constitutes a &#8220;word&#8221; is the same as for <A HREF="f_string-upcase.html" CLASS="funref"
><B
>string-capitalize</B
></A
>.</P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="v_print-base.html" CLASS="prev"
>&#8592;</A
><A HREF="v_print-circle.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
>