man-pages/man3/isalpha.3.html
2021-03-31 01:06:50 +01:00

564 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of ISALPHA</TITLE>
</HEAD><BODY>
<H1>ISALPHA</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">&nbsp;</A>
<H2>NAME</H2>
isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,
isprint, ispunct, isspace, isupper, isxdigit,
isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l,
isdigit_l, isgraph_l, islower_l,
isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l
- character classification functions
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/ctype.h">ctype.h</A>&gt;</B>
<B>int isalnum(int </B><I>c</I><B>);</B>
<B>int isalpha(int </B><I>c</I><B>);</B>
<B>int iscntrl(int </B><I>c</I><B>);</B>
<B>int isdigit(int </B><I>c</I><B>);</B>
<B>int isgraph(int </B><I>c</I><B>);</B>
<B>int islower(int </B><I>c</I><B>);</B>
<B>int isprint(int </B><I>c</I><B>);</B>
<B>int ispunct(int </B><I>c</I><B>);</B>
<B>int isspace(int </B><I>c</I><B>);</B>
<B>int isupper(int </B><I>c</I><B>);</B>
<B>int isxdigit(int </B><I>c</I><B>);</B>
<B>int isascii(int </B><I>c</I><B>);</B>
<B>int isblank(int </B><I>c</I><B>);</B>
<B>int isalnum_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isalpha_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isblank_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int iscntrl_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isdigit_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isgraph_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int islower_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isprint_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int ispunct_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isspace_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isupper_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isxdigit_l(int </B><I>c</I><B>, locale_t </B><I>locale</I><B>);</B>
<B>int isascii_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>isascii</B>():
<DL COMPACT><DT id="1"><DD>
_XOPEN_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;since&nbsp;2.19:&nbsp;*/&nbsp;_DEFAULT_SOURCE
<BR>&nbsp;&nbsp;&nbsp;&nbsp;||&nbsp;/*&nbsp;Glibc&nbsp;versions&nbsp;&lt;=&nbsp;2.19:&nbsp;*/&nbsp;_SVID_SOURCE
</DL>
<P>
<B>isblank</B>():
<DL COMPACT><DT id="2"><DD>
_ISOC99_SOURCE || _POSIX_C_SOURCE&nbsp;&gt;=&nbsp;200112L
</DL>
<P>
<B>isalnum_l</B>(),
<B>isalpha_l</B>(),
<B>isblank_l</B>(),
<B>iscntrl_l</B>(),
<B>isdigit_l</B>(),
<B>isgraph_l</B>(),
<B>islower_l</B>(),
<B>isprint_l</B>(),
<B>ispunct_l</B>(),
<B>isspace_l</B>(),
<B>isupper_l</B>(),
<B>isxdigit_l</B>():
<DL COMPACT><DT id="3"><DD>
<DL COMPACT>
<DT id="4">Since glibc 2.10:<DD>
_XOPEN_SOURCE&nbsp;&gt;=&nbsp;700
<DT id="5">Before glibc 2.10:<DD>
_GNU_SOURCE
</DL>
</DL>
<P>
<B>isascii_l</B>():
<DL COMPACT><DT id="6"><DD>
<DL COMPACT>
<DT id="7">Since glibc 2.10:<DD>
_XOPEN_SOURCE&nbsp;&gt;=&nbsp;700 &amp;&amp; (_SVID_SOURCE || _BSD_SOURCE)
<DT id="8">Before glibc 2.10:<DD>
_GNU_SOURCE
</DL>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
These functions check whether
<I>c</I>,
which must have the value of an
<I>unsigned char</I>
or
<B>EOF</B>,
falls into a certain character class according to the specified locale.
The functions without the
&quot;_l&quot; suffix perform the check based on the current locale.
<P>
The functions with the &quot;_l&quot; suffix perform the check
based on the locale specified by the locale object
<I>locale</I>.
The behavior of these functions 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.
<P>
The list below explains the operation of the functions without
the &quot;_l&quot; suffix;
the functions with the &quot;_l&quot; suffix differ only in using the locale object
<I>locale</I>
instead of the current locale.
<DL COMPACT>
<DT id="9"><B>isalnum</B>()
<DD>
checks for an alphanumeric character; it is equivalent to
<B>(isalpha(</B><I>c</I><B>) || isdigit(</B><I>c</I><B>))</B><I></I>.
<DT id="10"><B>isalpha</B>()
<DD>
checks for an alphabetic character; in the standard <B>&quot;C&quot;</B>
locale, it is equivalent to
<B>(isupper(</B><I>c</I><B>) || islower(</B><I>c</I><B>))</B><I></I>.
In some locales, there may be additional characters for which
<B>isalpha</B>()
is true---letters which are neither uppercase nor lowercase.
<DT id="11"><B>isascii</B>()
<DD>
checks whether <I>c</I> is a 7-bit
<I>unsigned char</I>
value that fits into
the ASCII character set.
<DT id="12"><B>isblank</B>()
<DD>
checks for a blank character; that is, a space or a tab.
<DT id="13"><B>iscntrl</B>()
<DD>
checks for a control character.
<DT id="14"><B>isdigit</B>()
<DD>
checks for a digit (0 through 9).
<DT id="15"><B>isgraph</B>()
<DD>
checks for any printable character except space.
<DT id="16"><B>islower</B>()
<DD>
checks for a lowercase character.
<DT id="17"><B>isprint</B>()
<DD>
checks for any printable character including space.
<DT id="18"><B>ispunct</B>()
<DD>
checks for any printable character which is not a space or an
alphanumeric character.
<DT id="19"><B>isspace</B>()
<DD>
checks for white-space characters.
In the
<B>C</B>
and
<B>POSIX</B>
locales, these are: space, form-feed
(<B>'\f'</B>),
newline
(<B>'\n'</B>),
carriage return
(<B>'\r'</B>),
horizontal tab
(<B>'\t'</B>),
and vertical tab
(<B>'\v'</B>).
<DT id="20"><B>isupper</B>()
<DD>
checks for an uppercase letter.
<DT id="21"><B>isxdigit</B>()
<DD>
checks for hexadecimal digits, that is, one of
<BR>
<B>0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F</B>.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
The values returned are nonzero if the character
<I>c</I>
falls into the tested class, and zero if not.
<A NAME="lbAF">&nbsp;</A>
<H2>VERSIONS</H2>
<B>isalnum_l</B>(),
<B>isalpha_l</B>(),
<B>isblank_l</B>(),
<B>iscntrl_l</B>(),
<B>isdigit_l</B>(),
<B>isgraph_l</B>(),
<B>islower_l</B>(),
<B>isprint_l</B>(),
<B>ispunct_l</B>(),
<B>isspace_l</B>(),
<B>isupper_l</B>(),
<B>isxdigit_l</B>(),
and
<B>isascii_l</B>()
are available since glibc 2.3.
<A NAME="lbAG">&nbsp;</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>isalnum</B>(),
<B>isalpha</B>(),
<B>isascii</B>(),
<B>isblank</B>(),
<B>iscntrl</B>(),
<B>isdigit</B>(),
<B>isgraph</B>(),
<B>islower</B>(),
<B>isprint</B>(),
<B>ispunct</B>(),
<B>isspace</B>(),
<B>isupper</B>(),
<B>isxdigit</B>()
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
</TABLE>
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
C89 specifies
<B>isalnum</B>(),
<B>isalpha</B>(),
<B>iscntrl</B>(),
<B>isdigit</B>(),
<B>isgraph</B>(),
<B>islower</B>(),
<B>isprint</B>(),
<B>ispunct</B>(),
<B>isspace</B>(),
<B>isupper</B>(),
and
<B>isxdigit</B>(),
but not
<B>isascii</B>()
and
<B>isblank</B>().
POSIX.1-2001
also specifies those functions, and also
<B>isascii</B>()
(as an XSI extension)
and
<B>isblank</B>().
C99 specifies all of the preceding functions, except
<B>isascii</B>().
<P>
POSIX.1-2008 marks
<B>isascii</B>()
as obsolete,
noting that it cannot be used portably in a localized application.
<P>
POSIX.1-2008 specifies
<B>isalnum_l</B>(),
<B>isalpha_l</B>(),
<B>isblank_l</B>(),
<B>iscntrl_l</B>(),
<B>isdigit_l</B>(),
<B>isgraph_l</B>(),
<B>islower_l</B>(),
<B>isprint_l</B>(),
<B>ispunct_l</B>(),
<B>isspace_l</B>(),
<B>isupper_l</B>(),
and
<B>isxdigit_l</B>().
<P>
<B>isascii_l</B>()
is a GNU extension.
<A NAME="lbAI">&nbsp;</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 of
<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 characters belong to which class depend on the
locale.
For example,
<B>isupper</B>()
will not recognize an A-umlaut (&Auml;) as an uppercase letter in the default
<B>C</B>
locale.
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+iswalnum">iswalnum</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswalpha">iswalpha</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswblank">iswblank</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswcntrl">iswcntrl</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswdigit">iswdigit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswgraph">iswgraph</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswlower">iswlower</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswprint">iswprint</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswpunct">iswpunct</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswspace">iswspace</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswupper">iswupper</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+iswxdigit">iswxdigit</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+toascii">toascii</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+tolower">tolower</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+toupper">toupper</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+uselocale">uselocale</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?7+ascii">ascii</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+locale">locale</A></B>(7)
<A NAME="lbAK">&nbsp;</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">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="22"><A HREF="#lbAB">NAME</A><DD>
<DT id="23"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="24"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="25"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="26"><A HREF="#lbAF">VERSIONS</A><DD>
<DT id="27"><A HREF="#lbAG">ATTRIBUTES</A><DD>
<DT id="28"><A HREF="#lbAH">CONFORMING TO</A><DD>
<DT id="29"><A HREF="#lbAI">NOTES</A><DD>
<DT id="30"><A HREF="#lbAJ">SEE ALSO</A><DD>
<DT id="31"><A HREF="#lbAK">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:46 GMT, March 31, 2021
</BODY>
</HTML>