iswprint
From cppreference.com
| Defined in header <wctype.h>
|
||
| int iswprint( wint_t ch ); |
(since C95) | |
Checks if the given wide character can be printed, i.e. it is either a number (0123456789), an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a lowercase letter (abcdefghijklmnopqrstuvwxyz), a punctuation character (!"#$%&'()*+,-./:;<=>?@[\]^_`{!}~), space or any printable character specific to the current C locale.
Contents |
[edit] Parameters
| ch | - | wide character |
[edit] Return value
Non-zero value if the wide character can be printed, zero otherwise.
[edit] Notes
ISO 30112 specifies which Unicode characters are included in POSIX print category.
[edit] Example
Run this code
#include <locale.h> #include <stdio.h> #include <wchar.h> #include <wctype.h> int main(void) { wchar_t c = L'\u2002'; // Unicode character 'EN SPACE' printf("in the default locale, iswprint(%#x) = %d\n", c, !!iswprint(c)); setlocale(LC_ALL, "en_US.utf8"); printf("in Unicode locale, iswprint(%#x) = %d\n", c, !!iswprint(c)); wchar_t c2 = L'\x82'; // break permitted printf("in Unicode locale, iswprint(%#x) = %d\n", c2, !!iswprint(c2)); }
Output:
in the default locale, iswprint(0x2002) = 0 in Unicode locale, iswprint(0x2002) = 1 in Unicode locale, iswprint(0x82) = 0
[edit] References
- C23 standard (ISO/IEC 9899:2024):
- 7.30.2.1.8 The iswprint function (p: TBD)
- C17 standard (ISO/IEC 9899:2018):
- 7.30.2.1.8 The iswprint function (p: TBD)
- C11 standard (ISO/IEC 9899:2011):
- 7.30.2.1.8 The iswprint function (p: 450)
- C99 standard (ISO/IEC 9899:1999):
- 7.25.2.1.8 The iswprint function (p: 396)
[edit] See also
| checks if a character is a printing character (function) | |
| C++ documentation for iswprint
| |
| ASCII values | characters |
isprint |
|||||
|---|---|---|---|---|---|---|---|