GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::wmemchr(3) C++ Standard Libary std::wmemchr(3)

std::wmemchr - std::wmemchr


Defined in header <cwchar>
const wchar_t* wmemchr( const wchar_t* ptr, wchar_t ch, std::size_t count );
wchar_t* wmemchr( wchar_t* ptr, wchar_t ch, std::size_t count );


Locates the first occurrence of wide character ch in the initial count wide
characters of the wide character array pointed to by ptr.


If count is zero, the function returns a null pointer.


ptr - pointer to the wide character array to be examined
ch - wide character to search for
count - number of wide characters to examine


Pointer to the location of the wide character, or a null pointer if no such
character is found.

// Run this code


#include <iostream>
#include <cwchar>
#include <clocale>
#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


memchr searches an array for the first occurrence of a character
(function)
strchr finds the first occurrence of a character
(function)
wcschr finds the first occurrence of a wide character in a wide string
(function)
find
find_if finds the first element satisfying specific criteria
find_if_not (function template)
(C++11)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.