282 lines
5.4 KiB
HTML
282 lines
5.4 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of TOUPPER</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>TOUPPER</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
toupper, tolower, toupper_l, tolower_l - convert uppercase or lowercase
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/ctype.h">ctype.h</A>></B>
|
|
|
|
<B>int toupper(int </B><I>c</I><B>);</B>
|
|
<B>int tolower(int </B><I>c</I><B>);</B>
|
|
|
|
<B>int toupper_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
|
|
<B>int tolower_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
<B>toupper_l</B>(),
|
|
|
|
<B>tolower_l</B>():
|
|
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
<DL COMPACT>
|
|
<DT id="2">Since glibc 2.10:<DD>
|
|
_XOPEN_SOURCE >= 700
|
|
<DT id="3">Before glibc 2.10:<DD>
|
|
_GNU_SOURCE
|
|
</DL>
|
|
</DL>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
These functions convert lowercase letters to uppercase, and vice versa.
|
|
<P>
|
|
|
|
If
|
|
<I>c</I>
|
|
|
|
is a lowercase letter,
|
|
<B>toupper</B>()
|
|
|
|
returns its uppercase equivalent,
|
|
if an uppercase representation exists in the current locale.
|
|
Otherwise, it returns
|
|
<I>c</I>.
|
|
|
|
The
|
|
<B>toupper_l</B>()
|
|
|
|
function performs the same task,
|
|
but uses the locale referred to by the locale handle
|
|
<I>locale</I>.
|
|
|
|
<P>
|
|
|
|
If
|
|
<I>c</I>
|
|
|
|
is an uppercase letter,
|
|
<B>tolower</B>()
|
|
|
|
returns its lowercase equivalent,
|
|
if a lowercase representation exists in the current locale.
|
|
Otherwise, it returns
|
|
<I>c</I>.
|
|
|
|
The
|
|
<B>tolower_l</B>()
|
|
|
|
function performs the same task,
|
|
but uses the locale referred to by the locale handle
|
|
<I>locale</I>.
|
|
|
|
<P>
|
|
|
|
If
|
|
<I>c</I>
|
|
|
|
is neither an
|
|
<I>unsigned char</I>
|
|
|
|
value nor
|
|
<B>EOF</B>,
|
|
|
|
the behavior of these functions
|
|
is undefined.
|
|
<P>
|
|
|
|
The behavior of
|
|
<B>toupper_l</B>()
|
|
|
|
and
|
|
<B>tolower_l</B>()
|
|
|
|
is undefined if
|
|
<I>locale</I>
|
|
|
|
is the special locale object
|
|
<B>LC_GLOBAL_LOCALE</B>
|
|
|
|
(see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+duplocale">duplocale</A></B>(3))
|
|
|
|
or is not a valid locale object handle.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
The value returned is that of the converted letter, or
|
|
<I>c</I>
|
|
|
|
if the conversion was not possible.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>toupper</B>(),
|
|
|
|
<B>tolower</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>toupper_l</B>(),
|
|
|
|
<B>tolower_l</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<B>toupper</B>(),
|
|
|
|
<B>tolower</B>():
|
|
|
|
C89, C99, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
|
|
<P>
|
|
|
|
<B>toupper_l</B>(),
|
|
|
|
<B>tolower_l</B>():
|
|
|
|
POSIX.1-2008.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The standards require that the argument
|
|
<I>c</I>
|
|
|
|
for these functions is either
|
|
<B>EOF</B>
|
|
|
|
or a value that is representable in the type
|
|
<I>unsigned char</I>.
|
|
|
|
If the argument
|
|
<I>c</I>
|
|
|
|
is of type
|
|
<I>char</I>,
|
|
|
|
it must be cast to
|
|
<I>unsigned char</I>,
|
|
|
|
as in the following example:
|
|
<P>
|
|
|
|
|
|
|
|
char c;
|
|
...
|
|
res = toupper((unsigned char) c);
|
|
|
|
|
|
<P>
|
|
|
|
This is necessary because
|
|
<I>char</I>
|
|
|
|
may be the equivalent
|
|
<I>signed char</I>,
|
|
|
|
in which case a byte where the top bit is set would be sign extended when
|
|
converting to
|
|
<I>int</I>,
|
|
|
|
yielding a value that is outside the range of
|
|
<I>unsigned char</I>.
|
|
|
|
<P>
|
|
|
|
The details of what constitutes an uppercase or lowercase letter depend
|
|
on the locale.
|
|
For example, the default
|
|
<B>C</B>
|
|
|
|
locale does not know about umlauts, so no conversion is done for them.
|
|
<P>
|
|
|
|
In some non-English locales, there are lowercase letters with no
|
|
corresponding uppercase equivalent;
|
|
|
|
|
|
|
|
the German sharp s is one example.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+isalpha">isalpha</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+newlocale">newlocale</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+setlocale">setlocale</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+towlower">towlower</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+towupper">towupper</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+uselocale">uselocale</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+locale">locale</A></B>(7)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="7"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="8"><A HREF="#lbAF">ATTRIBUTES</A><DD>
|
|
<DT id="9"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="10"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DT id="11"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:58 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|