size_t wcscspn (const wchar_t* wcs1, const wchar_t* wcs2);
Get span until character in wide string
Scans wcs1 for the first occurrence of any of the wide characters that are part of wcs2, returning the number of wide characters of wcs1 read before this first occurrence.
The search includes the terminating null wide characters. Therefore, the function will return the length of wcs1 if none of the characters of wcs2 are found in wcs1.
This is the wide character equivalent of strcspn (<cstring>).
- C wide string to be scanned.
- C wide string containing the characters to match.
The number of wide characters in the initial part of wcs1 that does not contain any of the characters that are part of wcs2.
This is the length of wcs1 if none of the wide characters in wcs2 are found in wcs1.
size_t is an unsigned integral type.
/* wcscspn example */
int main ()
wchar_t wcs = L"fcba73";
wchar_t keys = L"1234567890";
i = wcscspn (wcs,keys);
wprintf (L"The first number in wcs is at position %d.\n",i+1);
The first number in wcs is at position 5
- Get span until character in string (function)
- Locate characters in wide string (function)
- Get span of character set in wide string (function)
- Locate substring of wide string (function)