📄 wctype.html
字号:
<HTML><HEAD><TITLE><wctype.h></TITLE></HEAD><BODY><H1><A NAME="<wctype.h>"><CODE><wctype.h></CODE></A></H1><P>[Added with<A HREF="lib_over.html#Amendment 1">Amendment 1</A>]</P><HR><P><B><CODE><A HREF="#iswalnum">iswalnum</A>· <A HREF="#iswalpha">iswalpha</A>· <A HREF="#iswcntrl">iswcntrl</A>· <A HREF="#iswdigit">iswdigit</A>· <A HREF="#iswgraph">iswgraph</A>· <A HREF="#iswlower">iswlower</A>· <A HREF="#iswprint">iswprint</A>· <A HREF="#iswpunct">iswpunct</A>· <A HREF="#iswspace">iswspace</A>· <A HREF="#iswupper">iswupper</A>· <A HREF="#iswxdigit">iswxdigit</A>· <A HREF="#towlower">towlower</A>· <A HREF="#towctrans">towctrans</A>· <A HREF="#towupper">towupper</A>· <A HREF="#wctrans">wctrans</A>· <A HREF="#wctype">wctype</A></CODE></B></P><HR><P>Include the standard header <B><CODE><wctype.h></CODE></B>to declare several functions that are usefulfor classifying and mapping codes from the target wide-character set.</P><P>Every function that has a parameter of type<A HREF="#wint_t"><CODE>wint_t</CODE></A>can accept the value of the macro<A HREF="#WEOF"><CODE>WEOF</CODE></A>or any valid wide-character code (of type<A HREF="stddef.html#wchar_t"><CODE>wchar_t</CODE></A>).Thus, the argument can be the value returned by any of the functions:<A HREF="wchar.html#btowc"><CODE>btowc</CODE></A>,<A HREF="wchar.html#fgetwc"><CODE>fgetwc</CODE></A>,<A HREF="wchar.html#fputwc"><CODE>fputwc</CODE></A>,<A HREF="wchar.html#getwc"><CODE>getwc</CODE></A>,<A HREF="wchar.html#getwchar"><CODE>getwchar</CODE></A>,<A HREF="wchar.html#putwc"><CODE>putwc</CODE></A>,<A HREF="wchar.html#putwchar"><CODE>putwchar</CODE></A>,<A HREF="#towctrans"><CODE>towctrans</CODE></A>,<A HREF="#towlower"><CODE>towlower</CODE></A>,<A HREF="#towupper"><CODE>towupper</CODE></A>, or<A HREF="wchar.html#ungetwc"><CODE>ungetwc</CODE></A>.You must not call these functionswith other wide-character argument values.</P><P>The<B><A NAME="wide-character classification">wide-character classification</A></B>functions are strongly related to the (byte)<A HREF="ctype.html#character classification">character classification</A>functions. Each function <CODE>is<I>XXX</I></CODE>has a corresponding wide-character classificationfunction <CODE>isw<I>XXX</I></CODE>.Moreover, the wide-character classification functionsare interrelated much the same way as their correspondingbyte functions, with two added provisos:</P><UL><LI>The function<A HREF="#iswprint"><CODE>iswprint</CODE></A>, unlike<A HREF="ctype.html#isprint"><CODE>isprint</CODE></A>,can return a nonzero value for additional space charactersbesides the wide-character equivalent of <CODE><I>space</I></CODE>(<CODE>L' '</CODE>). Any such additional charactersreturn a nonzero value for<A HREF="#iswspace"><CODE>iswspace</CODE></A> and return zero for<A HREF="#iswgraph"><CODE>iswgraph</CODE></A> or<A HREF="#iswpunct"><CODE>iswpunct</CODE></A>.<LI>The characters in each wide-character class are a superset ofthe characters in the corresponding byte class.If the call <CODE>is<I>XXX</I>(c)</CODE> returns a nonzero value,then the corresponding call <CODE>isw<I>XXX</I>(btowc(c))</CODE>also returns a nonzero value.</UL><P>An implementation can define additional characters that returnnonzero for some of these functions. Any character set can containadditional characters that return nonzero for:</P><UL><LI><A HREF="#iswcntrl"><CODE>iswcntrl</CODE></A>(provided the characters cause<A HREF="#iswprint"><CODE>iswprint</CODE></A> to return zero)</LI><LI><A HREF="#iswpunct"><CODE>iswpunct</CODE></A>(provided the characters cause<A HREF="#iswalnum"><CODE>iswalnum</CODE></A> to return zero)</LI></UL><P>Moreover, a<A HREF="locale.html#locale">locale</A> other than the<A HREF="locale.html#C locale"><CODE>"C"</CODE></A> locale can defineadditional characters for:</P><UL><LI><A HREF="#iswalpha"><CODE>iswalpha</CODE></A>,<A HREF="#iswupper"><CODE>iswupper</CODE></A>, and<A HREF="#iswlower"><CODE>iswlower</CODE></A>(provided the characters cause<A HREF="#iswcntrl"><CODE>iswcntrl</CODE></A>,<A HREF="#iswdigit"><CODE>iswdigit</CODE></A>,<A HREF="#iswpunct"><CODE>iswpunct</CODE></A>, and<A HREF="#iswspace"><CODE>iswspace</CODE></A> to return zero)</LI><LI><A HREF="#iswspace"><CODE>iswspace</CODE></A>(provided the characters cause<A HREF="#iswpunct"><CODE>iswpunct</CODE></A> to return zero)</LI></UL><P>Note that the last rule differs slightly from the correspondingrule for the function<A HREF="ctype.html#isspace"><CODE>isspace</CODE></A>,as indicated above.Note also that an implementation can define a<A HREF="locale.html#locale">locale</A> other than the<A HREF="locale.html#C locale"><CODE>"C"</CODE></A> localein which a character can cause<A HREF="#iswalpha"><CODE>iswalpha</CODE></A> (and hence<A HREF="#iswalnum"><CODE>iswalnum</CODE></A>)to return nonzero, yet still cause<A HREF="#iswupper"><CODE>iswupper</CODE></A> and<A HREF="#iswlower"><CODE>iswlower</CODE></A> to return zero.</P><H2><A NAME="WEOF"><CODE>WEOF</CODE></A></H2><PRE>#define <B>WEOF</B> <I><</I>wint_t <I>constant expression></I></PRE><P>The macro yields the return value, of type<A HREF="#wint_t"><CODE>wint_t</CODE></A>,used to signal the end of a<A HREF="lib_file.html#wide stream">wide stream</A>or to report an error condition.</P><PRE> /* TYPES */typedef <I>s_type</I> <A HREF="#wctrans_t"><B>wctrans_t</B></A>;typedef <I>s_type</I> <A HREF="#wctype_t"><B>wctype_t</B></A>;typedef <I>i_type</I> <A HREF="#wint_t"><B>wint_t</B></A>; /* FUNCTIONS */int <A HREF="#iswalnum"><B>iswalnum</B></A>(wint_t c);int <A HREF="#iswalpha"><B>iswalpha</B></A>(wint_t c);int <A HREF="#iswcntrl"><B>iswcntrl</B></A>(wint_t c);int <A HREF="#iswctype"><B>iswctype</B></A>(wint_t c, wctype_t category);int <A HREF="#iswdigit"><B>iswdigit</B></A>(wint_t c);int <A HREF="#iswgraph"><B>iswgraph</B></A>(wint_t c);int <A HREF="#iswlower"><B>iswlower</B></A>(wint_t c);int <A HREF="#iswprint"><B>iswprint</B></A>(wint_t c);int <A HREF="#iswpunct"><B>iswpunct</B></A>(wint_t c);int <A HREF="#iswspace"><B>iswspace</B></A>(wint_t c);int <A HREF="#iswupper"><B>iswupper</B></A>(wint_t c);int <A HREF="#iswxdigit"><B>iswxdigit</B></A>(wint_t c);wint_t <A HREF="#towctrans"><B>towctrans</B></A>(wint_t c, wctrans_t category);wint_t <A HREF="#towlower"><B>towlower</B></A>(wint_t c);wint_t <A HREF="#towupper"><B>towupper</B></A>(wint_t c);wctrans_t <A HREF="#wctrans"><B>wctrans</B></A>(const char *property);wctype_t <A HREF="#wctype"><B>wctype</B></A>(const char *property);</PRE><H2><A NAME="iswalnum"><CODE>iswalnum</CODE></A></H2><PRE>int <B>iswalnum</B>(wint_t c);</PRE><P>The function returns nonzero if <CODE>c</CODE> is any of:</P><PRE>a b c d e f g h i j k l m n o p q r s t u v w x y zA B C D E F G H I J K L M N O P Q R S T U V W X Y Z0 1 2 3 4 5 6 7 8 9</PRE><P> or any other locale-specific alphabetic character.</P><H2><A NAME="iswalpha"><CODE>iswalpha</CODE></A></H2><PRE>int <B>iswalpha</B>(wint_t c);</PRE><P>The function returns nonzero if <CODE>c</CODE> is any of:</P><PRE>a b c d e f g h i j k l m n o p q r s t u v w x y zA B C D E F G H I J K L M N O P Q R S T U V W X Y Z</PRE><P> or any other locale-specific alphabetic character.</P><H2><A NAME="iswcntrl"><CODE>iswcntrl</CODE></A></H2><PRE>int <B>iswcntrl</B>(wint_t c);</PRE><P>The function returns nonzero if <CODE>c</CODE> is any of:</P><PRE><I>BEL BS CR FF HT NL VT</I></PRE><P>or any other implementation-defined control character.</P><H2><A NAME="iswctype"><CODE>iswctype</CODE></A></H2><PRE>int <B>iswctype</B>(wint_t c, wctype_t category);</PRE><P>The function returns nonzero if <CODE>c</CODE> is any character inthe category <CODE>category</CODE>.The value of <CODE>category</CODE> must havebeen returned by an earlier successful call to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -