std:: iswctype
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Null-terminated wide strings
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cwctype>
|
||
|
int
iswctype
(
std::
wint_t
wc,
std::
wctype_t
desc
)
;
|
||
현재 C 로캘의 wc 와이드 문자를 desc 로 식별되는 LC_CTYPE 카테고리를 사용하여 분류합니다.
wc 값이 wchar_t 로 표현 가능하지도 않고 매크로 WEOF 의 값과 같지도 않다면, 동작은 정의되지 않습니다.
목차 |
매개변수
| wc | - | 분류할 와이드 문자 |
| desc | - | LC_CTYPE 카테고리, std::wctype 호출로부터 획득됨 |
반환값
문자 wc 가 현재 C 로캘의 LC_CTYPE 패싯에서 desc 로 식별된 속성을 가지면 0이 아닌 값, 그렇지 않으면 0을 반환합니다.
예제
이 코드 실행
#include <clocale> #include <cwctype> #include <iostream> bool classify(wchar_t wc, const std::string& cat) { return std::iswctype(wc, std::wctype(cat.c_str())); } int main() { std::setlocale(LC_ALL, "ja_JP.UTF-8"); std::cout << "The character \u6c34 is...\n"; for (std::string s : {"digit", "alpha", "space", "cntrl", "jkanji"}) std::cout << s << "? " << std::boolalpha << classify(L'\u6c34', s) << '\n'; }
출력:
The character 水 is... digit? false alpha? true space? false cntrl? false jkanji? true
참고 항목
|
현재 C 로캘에서 문자 분류 카테고리를 조회합니다
(함수) |
|
|
C documentation
for
iswctype
|
|