blob: 36141d095f7fa7e30d8f49d0b450b438327b664c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<h1 id="firstHeading" class="firstHeading">iswctype</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><wctype.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl"> <td> <pre data-language="c">int iswctype( wint_t wc, wctype_t desc );</pre>
</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c95">(since C95)</span> </td> </tr> </table> <p>Classifies the wide character <code>wc</code> using the current C locale's <code><a href="../../locale/lc_categories" title="c/locale/LC categories">LC_CTYPE</a></code> category identified by <code>desc</code>.</p>
<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> wc </td> <td> - </td> <td> the wide character to classify </td>
</tr> <tr class="t-par"> <td> desc </td> <td> - </td> <td> the <code><a href="../../locale/lc_categories" title="c/locale/LC categories">LC_CTYPE</a></code> category, obtained from a call to <code><a href="wctype" title="c/string/wide/wctype">wctype</a></code> </td>
</tr>
</table> <h3 id="Return_value"> Return value</h3> <p>Non-zero if the character <code>wc</code> has the property identified by <code>desc</code> in <code><a href="../../locale/lc_categories" title="c/locale/LC categories">LC_CTYPE</a></code> facet of the current C locale, zero otherwise.</p>
<h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include <locale.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
const char* classify(wchar_t wc, const char* cat)
{
return iswctype(wc, wctype(cat)) ? "true" : "false";
}
int main(void)
{
setlocale(LC_ALL, "ja_JP.UTF-8");
puts("The character \u6c34 is...");
const char* cats[] = {"digit", "alpha", "space", "cntrl", "jkanji"};
for (int n = 0; n < 5; ++n)
printf("%s?\t%s\n", cats[n], classify(L'\u6c34', cats[n]));
}</pre></div> <p>Output:</p>
<div class="text source-text"><pre data-language="c">The character 水 is...
digit? false
alpha? true
space? false
cntrl? false
jkanji? true</pre></div> </div> <h3 id="References"> References</h3> <ul>
<li> C23 standard (ISO/IEC 9899:2023): </li>
<ul><li> 7.30.2.2.1 The iswctype function (p: TBD) </li></ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul><li> 7.30.2.2.1 The iswctype function (p: TBD) </li></ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul><li> 7.30.2.2.1 The iswctype function (p: 451-452) </li></ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul><li> 7.25.2.2.1 The iswctype function (p: 397-398) </li></ul>
</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="wctype" title="c/string/wide/wctype"> <span class="t-lines"><span>wctype</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> looks up a character classification category in the current C locale <br> <span class="t-mark">(function)</span> </td>
</tr> </table> <div class="_attribution">
<p class="_attribution-p">
© cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
<a href="https://en.cppreference.com/w/c/string/wide/iswctype" class="_attribution-link">https://en.cppreference.com/w/c/string/wide/iswctype</a>
</p>
</div>
|