From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/string%2Fwide%2Fiswctype.html | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 devdocs/c/string%2Fwide%2Fiswctype.html (limited to 'devdocs/c/string%2Fwide%2Fiswctype.html') diff --git a/devdocs/c/string%2Fwide%2Fiswctype.html b/devdocs/c/string%2Fwide%2Fiswctype.html new file mode 100644 index 00000000..36141d09 --- /dev/null +++ b/devdocs/c/string%2Fwide%2Fiswctype.html @@ -0,0 +1,46 @@ +

iswctype

Defined in header <wctype.h>
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.

+

Parameters

+ + +
wc - the wide character to classify
desc - the LC_CTYPE category, obtained from a call to wctype

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.

+

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

References

See also

+
+
(C95)
looks up a character classification category in the current C locale
(function)
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/string/wide/iswctype +

+
-- cgit v1.2.3