std:: wmemchr
From fr.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 | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
|
Défini dans l'en-tête
<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) | |
Localise la première occurrence du caractère large ch dans les count premiers caractères larges du tableau de caractères larges pointé par ptr .
Si count est zéro, la fonction retourne un pointeur nul.
SommaireParamètres
Valeur de retourPointeur vers l'emplacement du caractère large, ou un pointeur nul si aucun caractère de ce type n'est trouvé. Exemple
Exécuter ce code
#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'; } } Sortie possible : Found '许' at position 14 Voir aussi
| |||||||||||||||||||||