size_t wcsspn (const wchar_t* wcs1, const wchar_t* wcs2);
Get span of character set in wide string
Returns the length of the initial portion of wcs1 which consists only of wide characters that are part of wcs2.
The search does not include the terminating null wide characters of either strings, but ends there.
This is the wide character equivalent of strspn (<cstring>).
- C wide string to be scanned.
- C wide string containing the characters to match.
The length of the initial portion of wcs1 containing only wide characters that appear in wcs2.
Therefore, if all of the wide characters in wcs1 are in wcs2, the function returns the length of the entire wcs1 wide string, and if the first wide character in wcs1 is not in wcs2, the function returns zero.
size_t is an unsigned integral type.
/* wcsspn example */
int main ()
wchar_t wcsText = L"129th";
wchar_t wcsSet = L"1234567890";
i = wcsspn (wcsText,wcsSet);
wprintf (L"The initial number has %d digits.\n",i);
The initial number has 3 digits.
- Get span of character set in string (function)
- Get span until character in wide string (function)
- Locate substring of wide string (function)
- Compare characters of two wide strings (function)