A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../algorithm/../../cpp/../c/string/wide/iswctype.html below:

iswctype - cppreference.com

int iswctype( wint_t wc, wctype_t desc );

(since C95)

Classifies the wide character wc using the current C locale's LC_CTYPE category identified by desc.

[edit] Parameters wc - the wide character to classify desc - the LC_CTYPE category, obtained from a call to wctype [edit] Return value

Non-zero if the character wc has the property identified by desc in LC_CTYPE facet of the current C locale, zero otherwise.

[edit] Example
#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]));
}

Output:

The character æ°´ is...
digit?  false
alpha?  true
space?  false
cntrl?  false
jkanji? true
[edit] References
[edit] See also looks up a character classification category in the current C locale
(function) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4