std:: wmemchr
From ko.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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cwchar>
|
||
|
const
wchar_t
*
wmemchr
(
const
wchar_t
*
ptr,
wchar_t
ch,
std::
size_t
count
)
;
|
(1) | |
|
wchar_t
*
wmemchr
(
wchar_t
*
ptr,
wchar_t
ch,
std::
size_t
count
)
;
|
(2) | |
ch 와이드 문자를 가리키는 ptr 와이드 문자 배열의 처음 count 개 와이드 문자에서 처음으로 나타나는 위치를 찾습니다.
만약 count 가 0이면, 함수는 널 포인터를 반환합니다.
목차매개변수
반환값와이드 문자의 위치에 대한 포인터, 해당 문자가 발견되지 않으면 널 포인터입니다. 예제
이 코드 실행
#include <clocale> #include <cwchar> #include <iostream> #include <locale> int main() { const wchar_t str[] = L"诺不轻信,故人不负我\0诺不轻许,故我不负人。"; wchar_t target = L'许'; const std::size_t sz = sizeof str / sizeof *str; if (const wchar_t* result = std::wmemchr(str, target, sz)) { std::setlocale(LC_ALL, "en_US.utf8"); std::wcout.imbue(std::locale("en_US.utf8")); std::wcout << "Found '" << target << "' at position " << result - str << '\n'; } } 가능한 출력: Found '许' at position 14 참고 항목
| |||||||||||||||||||||