### wcsspn -- Search Wide-Character Strings

Format

>     #include <wcstr.h>
>     size_t wcsspn(const wchar_t *string1, const wchar_t *string2);

Language Level: XPG4
wcsspn scans string1 for the wide characters contained in string2. It stops when it encounters a character in string1 that is not in string2.

Return Value
wcsspn returns the number of wide characters from string2 that it found in string1.

Example
This example finds the first occurrence in the array string of a wide character that is not an a, b, or c. Because the string in this example is cabbage, wcsspn returns 5, the index of the segment of cabbage before a character that is not an a, b, or c.

    #include <stdio.h>
    #include <wcstr.h>

    int main(void)
    {
      wchar_t * string = L"cabbage";
      wchar_t * source = L"abc";
      int index;

      index = wcsspn( string, L"abc" );
      printf( "The first %d characters of \"%ls\" are found in \"%ls\"\n",
                  index, string, source );
      return 0;

      /********************************************************************
         The output should be:

         The first 5 characters of "cabbage" are found in "abc"
      ********************************************************************/
    }

strchr -- Search for Character
strcspn -- Compare Strings for Substrings
strpbrk -- Find Characters in String
strrchr -- Find Last Occurrence of Character in String
strspn -- Search Strings
wcscat -- Concatenate Wide-Character Strings
wcschr -- Search for Wide Character
wcscmp -- Compare Wide-Character Strings
wcscspn -- Find Offset of First Wide-Character Match
wcsncmp -- Compare Wide-Character Strings
wcsrchr -- Locate Wide Character in String
wcsspn -- Search Wide-Character Strings
wcswcs -- Locate Wide-Character Substring
wcspbrk -- Locate Wide Characters in String
<wcstr.h>