const wchar_t* wcspbrk (const wchar_t* wcs1, const wchar_t* wcs2);
wchar_t* wcspbrk ( wchar_t* wcs1, const wchar_t* wcs2);
Locate characters in wide string
Returns a pointer to the first occurrence in wcs1 of any of the wide characters that are part of wcs2, or a null pointer if there are no matches.
The search does not include the terminating null wide characters of either wide strings, but ends there.
This is the wide character equivalent of strpbrk (<cstring>).
- C wide string to be scanned.
- C wide string containing the characters to match.
A pointer to the first occurrence in wcs1 of any of the wide characters that are part of wcs2, or a null pointer if none of the characters of wcs2 is found in wcs1 before the terminating null wide character.
If none of the characters of wcs2 is present in wcs1, a null pointer is returned.
In C, this function is only declared as:
wchar_t * wcspbrk ( const wchar_t *, const wchar_t * );
instead of the two overloaded versions provided in C++.
/* wcspbrk example */
int main ()
wchar_t wcs = L"This is a sample wide string";
wchar_t key = L"aeiou";
wchar_t * pwc;
wprintf (L"Vowels in '%ls': ",wcs);
pwc = wcspbrk (wcs, key);
while (pwc != NULL)
wprintf (L"%c " , *pwc);
pwc = wcspbrk (pwc+1,key);
Vowels in 'This is a sample string': i i a a e i e i
- Locate characters in string (function
- Get span until character in wide string (function
- Locate first occurrence of character in wide string (function
- Locate last occurrence of character in wide string (function
- Locate character in block of wide characters (function