A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to the null-terminated wide-character string to be scanned.
2nd Parameter Type : const wchar_t *
A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
2nd Parameter
Pointer to the null-terminated wide-character string containing the set of acceptable wide characters.
Read more about parameters of wcsspn in parameters section
The wcsspnfunction in C language Calculates the length of the initial segment of a wide character string which consists only of characters that are part of another wide character string.
wcsspn computes the length of the maximum initial segment of the wide-character string pointed to by s1 which consists entirely of wide-characters from the wide-character string pointed to by s2.
The wcsspnfunction takes 2
parameters:
•
const wchar_t * `ws1`: Pointer to the null-terminated wide-character string to be scanned.
•
const wchar_t * `ws2`: Pointer to the null-terminated wide-character string containing the set of acceptable wide characters.
Calculates the length of the initial segment of `ws1` that consists entirely of characters found in `ws2`. Returns the number of wide characters in this segment.
The wcsspn function return value :
Returns the length of the initial substring of s1 that contains only characters found in s2
Output
This example demonstrates the basic usage of wcsspn to find the length of the initial segment of a string containing only digits.