1
0
Fork 0
cl-sites/HyperSpec-7-0/HyperSpec/Body/f_stg_up.htm
2024-04-01 10:24:07 +02:00

96 lines
10 KiB
HTML

<!-- Common Lisp HyperSpec (TM), version 7.0 generated by Kent M. Pitman on Mon, 11-Apr-2005 2:31am EDT -->
<HTML>
<HEAD>
<TITLE>CLHS: Function STRING-UPCASE, STRING-DOWNCASE...</TITLE>
<LINK HREF="../Data/clhs.css" REL="stylesheet" TYPE="text/css" />
<META HTTP-EQUIV="Author" CONTENT="Kent M. Pitman">
<META HTTP-EQUIV="Organization" CONTENT="LispWorks Ltd.">
<LINK REL=TOP HREF="../Front/index.htm">
<LINK REL=COPYRIGHT HREF="../Front/Help.htm#Legal">
<LINK REL=DISCLAIMER HREF="../Front/Help.htm#Disclaimer">
<LINK REL=PREV HREF="f_string.htm">
<LINK REL=UP HREF="c_string.htm">
<LINK REL=NEXT HREF="f_stg_tr.htm">
</HEAD>
<BODY>
<H1><A REV=MADE HREF="http://www.lispworks.com/"><IMG WIDTH=80 HEIGHT=65 ALT="[LISPWORKS]" SRC="../Graphics/LWSmall.gif" ALIGN=Bottom></A><A REL=TOP HREF="../Front/index.htm"><IMG WIDTH=237 HEIGHT=65 ALT="[Common Lisp HyperSpec (TM)]" SRC="../Graphics/CLHS_Sm.gif" ALIGN=Bottom></A> <A REL=PREV HREF="f_string.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Previous]" SRC="../Graphics/Prev.gif" ALIGN=Bottom></A><A REL=UP HREF="c_string.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Up]" SRC="../Graphics/Up.gif" ALIGN=Bottom></A><A REL=NEXT HREF="f_stg_tr.htm"><IMG WIDTH=40 HEIGHT=40 ALT="[Next]" SRC="../Graphics/Next.gif" ALIGN=Bottom></A></H1>
<HR>
<A NAME="string-upcase"><A NAME="string-downcase"><A NAME="string-capitalize"><A NAME="nstring-upcase"><A NAME="nstring-downcase"><A NAME="nstring-capitalize"><I>Function</I> <B>STRING-UPCASE, STRING-DOWNCASE, STRING-CAPITALIZE, NSTRING-UPCASE, NSTRING-DOWNCASE, NSTRING-CAPITALIZE</B></A></A></A></A></A></A> <P>
<P><B>Syntax:</B><P>
<P>
<B>string-upcase</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>cased-string</I><P>
<B>string-downcase</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>cased-string</I><P>
<B>string-capitalize</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>cased-string</I><P>
<P>
<B>nstring-upcase</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>string</I><P>
<B>nstring-downcase</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>string</I><P>
<B>nstring-capitalize</B> <I>string </I><TT>&amp;key</TT><I> start end</I> =&gt; <I>string</I><P>
<P>
<P><B>Arguments and Values:</B><P>
<P>
<I>string</I>---a <A REL=DEFINITION HREF="26_glo_s.htm#string_designator"><I>string designator</I></A>. For <A REL=DEFINITION HREF="#nstring-upcase"><B>nstring-upcase</B></A>, <A REL=DEFINITION HREF="#nstring-downcase"><B>nstring-downcase</B></A>, and <A REL=DEFINITION HREF="#nstring-capitalize"><B>nstring-capitalize</B></A>, the <I>string</I> <A REL=DEFINITION HREF="26_glo_d.htm#designator"><I>designator</I></A> must be a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>. <P>
<I>start</I>, <I>end</I>---<A REL=DEFINITION HREF="26_glo_b.htm#bounding_index_designator"><I>bounding index designators</I></A> of <I>string</I>. The defaults for <I>start</I> and <I>end</I> are <TT>0</TT> and <A REL=DEFINITION HREF="a_nil.htm#nil"><B>nil</B></A>, respectively. <P>
<I>cased-string</I>---a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>. <P>
<P><B>Description:</B><P>
<P>
<A REL=DEFINITION HREF="#string-upcase"><B>string-upcase</B></A>, <A REL=DEFINITION HREF="#string-downcase"><B>string-downcase</B></A>, <A REL=DEFINITION HREF="#string-capitalize"><B>string-capitalize</B></A>, <A REL=DEFINITION HREF="#nstring-upcase"><B>nstring-upcase</B></A>, <A REL=DEFINITION HREF="#nstring-downcase"><B>nstring-downcase</B></A>, <A REL=DEFINITION HREF="#nstring-capitalize"><B>nstring-capitalize</B></A> change the case of the subsequence of <I>string</I> <A REL=DEFINITION HREF="26_glo_b.htm#bounded"><I>bounded</I></A> by <I>start</I> and <I>end</I> as follows: <P>
<P><DL><DT><B>string-upcase</B> <P><DD>
<A REL=DEFINITION HREF="#string-upcase"><B>string-upcase</B></A> returns a <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> just like <I>string</I> with all lowercase characters replaced by the corresponding uppercase characters. More precisely, each character of the result <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A> is produced by applying the <A REL=DEFINITION HREF="26_glo_f.htm#function"><I>function</I></A> <A REL=DEFINITION HREF="f_char_u.htm#char-upcase"><B>char-upcase</B></A> to the corresponding character of <I>string</I>. <P>
<DT><B>string-downcase</B> <P><DD>
<A REL=DEFINITION HREF="#string-downcase"><B>string-downcase</B></A> is like <A REL=DEFINITION HREF="#string-upcase"><B>string-upcase</B></A> except that all uppercase characters are replaced by the corresponding lowercase characters (using <A REL=DEFINITION HREF="f_char_u.htm#char-downcase"><B>char-downcase</B></A>). <P>
<DT><B>string-capitalize</B> <P><DD>
<A REL=DEFINITION HREF="#string-capitalize"><B>string-capitalize</B></A> produces a copy of <I>string</I> such that, for every word in the copy, the first <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>character</I></A> of the ``word,'' if it has <A REL=DEFINITION HREF="26_glo_c.htm#case"><I>case</I></A>, is <A REL=DEFINITION HREF="26_glo_u.htm#uppercase"><I>uppercase</I></A> and any other <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>characters</I></A> with <A REL=DEFINITION HREF="26_glo_c.htm#case"><I>case</I></A> in the word are <A REL=DEFINITION HREF="26_glo_l.htm#lowercase"><I>lowercase</I></A>. For the purposes of <A REL=DEFINITION HREF="#string-capitalize"><B>string-capitalize</B></A>, a ``word'' is defined to be a consecutive subsequence consisting of <A REL=DEFINITION HREF="26_glo_a.htm#alphanumeric"><I>alphanumeric</I></A> <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>characters</I></A>, delimited at each end either by a non-<A REL=DEFINITION HREF="26_glo_a.htm#alphanumeric"><I>alphanumeric</I></A> <A REL=DEFINITION HREF="26_glo_c.htm#character"><I>character</I></A> or by an end of the <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>. <P>
<DT><B>nstring-upcase, nstring-downcase, nstring-capitalize </B> <P><DD>
<A REL=DEFINITION HREF="#nstring-upcase"><B>nstring-upcase</B></A>, <A REL=DEFINITION HREF="#nstring-downcase"><B>nstring-downcase</B></A>, and <A REL=DEFINITION HREF="#nstring-capitalize"><B>nstring-capitalize</B></A> are identical to <A REL=DEFINITION HREF="#string-upcase"><B>string-upcase</B></A>, <A REL=DEFINITION HREF="#string-downcase"><B>string-downcase</B></A>, and <A REL=DEFINITION HREF="#string-capitalize"><B>string-capitalize</B></A> respectively except that they modify <I>string</I>. <P></DL><P>
For <A REL=DEFINITION HREF="#string-upcase"><B>string-upcase</B></A>, <A REL=DEFINITION HREF="#string-downcase"><B>string-downcase</B></A>, and <A REL=DEFINITION HREF="#string-capitalize"><B>string-capitalize</B></A>, <I>string</I> is not modified. However, if no characters in <I>string</I> require conversion, the result may be either <I>string</I> or a copy of it, at the implementation's discretion. <P>
<P><B>Examples:</B><P>
<PRE>
(string-upcase &quot;abcde&quot;) =&gt; &quot;ABCDE&quot;
(string-upcase &quot;Dr. Livingston, I presume?&quot;)
=&gt; &quot;DR. LIVINGSTON, I PRESUME?&quot;
(string-upcase &quot;Dr. Livingston, I presume?&quot; :start 6 :end 10)
=&gt; &quot;Dr. LiVINGston, I presume?&quot;
(string-downcase &quot;Dr. Livingston, I presume?&quot;)
=&gt; &quot;dr. livingston, i presume?&quot;
(string-capitalize &quot;elm 13c arthur;fig don't&quot;) =&gt; &quot;Elm 13c Arthur;Fig Don'T&quot;
(string-capitalize &quot; hello &quot;) =&gt; &quot; Hello &quot;
(string-capitalize &quot;occlUDeD cASEmenTs FOreSTAll iNADVertent DEFenestraTION&quot;)
=&gt; &quot;Occluded Casements Forestall Inadvertent Defenestration&quot;
(string-capitalize 'kludgy-hash-search) =&gt; &quot;Kludgy-Hash-Search&quot;
(string-capitalize &quot;DON'T!&quot;) =&gt; &quot;Don'T!&quot; ;not &quot;Don't!&quot;
(string-capitalize &quot;pipe 13a, foo16c&quot;) =&gt; &quot;Pipe 13a, Foo16c&quot;
(setq str (copy-seq &quot;0123ABCD890a&quot;)) =&gt; &quot;0123ABCD890a&quot;
(nstring-downcase str :start 5 :end 7) =&gt; &quot;0123AbcD890a&quot;
str =&gt; &quot;0123AbcD890a&quot;
</PRE>
</TT> <P>
<P><B>Side Effects:</B><P>
<P>
<A REL=DEFINITION HREF="#nstring-upcase"><B>nstring-upcase</B></A>, <A REL=DEFINITION HREF="#nstring-downcase"><B>nstring-downcase</B></A>, and <A REL=DEFINITION HREF="#nstring-capitalize"><B>nstring-capitalize</B></A> modify <I>string</I> as appropriate rather than constructing a new <A REL=DEFINITION HREF="26_glo_s.htm#string"><I>string</I></A>. <P>
<P><B>Affected By:</B> None.
<P>
<P><B>Exceptional Situations:</B> None.
<P>
<P><B>See Also:</B><P>
<P>
<A REL=DEFINITION HREF="f_char_u.htm#char-upcase"><B>char-upcase</B></A>, <A REL=DEFINITION HREF="f_char_u.htm#char-downcase"><B>char-downcase</B></A> <P>
<P><B>Notes:</B><P>
The result is always of the same length as <I>string</I>. <P>
<P><HR>The following <A REL=META HREF="../Front/X3J13Iss.htm">X3J13 cleanup issues</A>, <I>not part of the specification</I>, apply to this section:<P><UL><LI> <A REL=CHILD HREF="../Issues/iss284.htm">RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL</A><LI> <A REL=CHILD HREF="../Issues/iss332.htm">SUBSEQ-OUT-OF-BOUNDS</A><LI> <A REL=CHILD HREF="../Issues/iss329.htm">STRING-COERCION:MAKE-CONSISTENT</A><P></UL><HR>
<A REL=NAVIGATOR HREF="../Front/StartPts.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Starting Points]" SRC="../Graphics/StartPts.gif" ALIGN=Bottom></A><A REL=TOC HREF="../Front/Contents.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Contents]" SRC="../Graphics/Contents.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Master.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Index]" SRC="../Graphics/Index.gif" ALIGN=Bottom></A><A REL=INDEX HREF="../Front/X_Symbol.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Symbols]" SRC="../Graphics/Symbols.gif" ALIGN=Bottom></A><A REL=GLOSSARY HREF="../Body/26_a.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Glossary]" SRC="../Graphics/Glossary.gif" ALIGN=Bottom></A><A HREF="../Front/X3J13Iss.htm"><IMG WIDTH=80 HEIGHT=40 ALT="[Issues]" SRC="../Graphics/Issues.gif" ALIGN=Bottom></A><BR>
<A REL=COPYRIGHT HREF="../Front/Help.htm#Legal"><I>Copyright 1996-2005, LispWorks Ltd. All rights reserved.</I></A><P>
</BODY>
</HTML>