iswpunct
From cppreference.com
| Defined in header <wctype.h>
|
||
int iswpunct( wint_t ch );
|
(since C95) | |
Checks if the given wide character is a punctuation character, i.e. it is one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ or any punctuation character specific to the current locale.
Parameters
| ch | - | wide character |
Return value
Non-zero value if the wide character is a punctuation character, zero otherwise.
Notes
ISO 30112 specifies which Unicode characters are include in POSIX punct category.
Example
Run this code
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
int main(void)
{
const wchar_t c = L'\u2051'; // Two asterisks ('⁑')
printf("in the default locale, iswpunct(%#x) = %d\n", c, !!iswpunct(c));
setlocale(LC_ALL, "en_US.utf8");
printf("in Unicode locale, iswpunct(%#x) = %d\n", c, !!iswpunct(c));
}
Output:
in the default locale, iswpunct(0x2051) = 0
in Unicode locale, iswpunct(0x2051) = 1
References
- C23 standard (ISO/IEC 9899:2024):
- 7.30.2.1.9 The iswpunct function (p: TBD)
- C17 standard (ISO/IEC 9899:2018):
- 7.30.2.1.9 The iswpunct function (p: TBD)
- C11 standard (ISO/IEC 9899:2011):
- 7.30.2.1.9 The iswpunct function (p: 450)
- C99 standard (ISO/IEC 9899:1999):
- 7.25.2.1.9 The iswpunct function (p: 396)
See also
| checks if a character is a punctuation character (function) | |
C++ documentation for iswpunct
| |
