iswgraph

来自cppreference.com
< c‎ | string‎ | wide
在标头 <wctype.h> 定义
int iswgraph( wint_t ch );
(C95 起)

检查给定的宽字符是否拥有图形表示,即是数字(0123456789)、大写字母(ABCDEFGHIJKLMNOPQRSTUVWXYZ)、小写字母(abcdefghijklmnopqrstuvwxyz)、标点字符({{tt|!"#$%&'()*+,-./:;<=>?@[\]^_`{!}~)之一或任何限定于当前 C 本地环境的图形字符。

目录

[编辑]参数

ch - 宽字符

[编辑]返回值

若给定字符拥有图形表示则为非零,否则为零。

[编辑]注意

ISO 30112 指定哪些 Unicode 字符包含于 POSIX 图形类别。

[编辑]示例

#include <locale.h>#include <stdio.h>#include <wchar.h>#include <wctype.h>   int main(void){wchar_t c = L'\u2602';// Unicode 字符伞 ('☂')printf("in the default locale, iswgraph(%#x) = %d\n", c, !!iswgraph(c));setlocale(LC_ALL, "en_US.utf8");printf("in Unicode locale, iswgraph(%#x) = %d\n", c, !!iswgraph(c));}

输出:

in the default locale, iswgraph(0x2602) = 0 in Unicode locale, iswgraph(0x2602) = 1

[编辑]引用

  • C23 标准(ISO/IEC 9899:2024):
  • 7.30.2.1.6 The iswgraph function (第 TBD 页)
  • C17 标准(ISO/IEC 9899:2018):
  • 7.30.2.1.6 The iswgraph function (第 TBD 页)
  • C11 标准(ISO/IEC 9899:2011):
  • 7.30.2.1.6 The iswgraph function (第 449-450 页)
  • C99 标准(ISO/IEC 9899:1999):
  • 7.25.2.1.6 The iswgraph function (第 395-396 页)

[编辑]参阅

检查字符是否是图形字符
(函数)[编辑]
iswgraph 的 C++ 文档
ASCII 值 字符

iscntrl
iswcntrl

isprint
iswprint

isspace
iswspace

isblank
iswblank

isgraph
iswgraph

ispunct
iswpunct

isalnum
iswalnum

isalpha
iswalpha

isupper
iswupper

islower
iswlower

isdigit
iswdigit

isxdigit
iswxdigit

十进制 十六进制 八进制
0–8 \x0\x8\0\10 控制码 (NUL 等) ≠000000000000
9 \x9\11 制表符 (\t) ≠00≠0≠000000000
10–13 \xA\xD\12\15 空白符 (\n, \v, \f, \r) ≠00≠0000000000
14–31 \xE\x1F\16\37 控制码 ≠000000000000
32 \x20\40 空格 0≠0≠0≠000000000
33–47 \x21\x2F\41\57!"#$%&'()*+,-./0≠000≠0≠0000000
48–57 \x30\x39\60\7101234567890≠000≠00≠0000≠0≠0
58–64 \x3A\x40\72\100:;<=>?@0≠000≠0≠0000000
65–70 \x41\x46\101\106ABCDEF0≠000≠00≠0≠0≠000≠0
71–90 \x47\x5A\107\132GHIJKLMNOP
QRSTUVWXYZ
0≠000≠00≠0≠0≠0000
91–96 \x5B\x60\133\140[\]^_`0≠000≠0≠0000000
97–102 \x61\x66\141\146abcdef0≠000≠00≠0≠00≠00≠0
103–122 \x67\x7A\147\172ghijklmnop
qrstuvwxyz
0≠000≠00≠0≠00≠000
123–126 \x7B\x7E\173\176{|}~0≠000≠0≠0000000
127 \x7F\177 退格符 (DEL) ≠000000000000
close