wcschr -- Search for Wide Character

Format

#include <wcstr.h>
wchar_t *wcschr(const wchar_t *string, wchar_t character);

Language Level: XPG4
wcschr searches the wide-character string for the occurrence of character. The character can be a wchar_t null character (\0); the wchar_t null character at the end of string is included in the search.

wcschr operates on null-terminated wchar_t strings. The string argument to this function should contain a wchar_t null character marking the end of the string.

Return Value
wcschr returns a pointer to the first occurrence of character in string. If the character is not found, a NULL pointer is returned.

Example
This example finds the first occurrence of the character p in the wide-character string "computer program".

#include <stdio.h>
#include <wcstr.h>
#define SIZE 40
int main(void)
{
  wchar_t buffer1[SIZE] = L"computer program";
  wchar_t * ptr;
  wchar_t ch = L'p';
  ptr = wcschr( buffer1, ch );
  printf( "The first occurrence of %lc in '%ls' is '%ls'\n",
                          ch, buffer1, ptr );
  return 0;
  /***********************************************************************
     The output should be:
     The first occurrence of p in 'computer program' is 'puter program'
  ***********************************************************************/
}


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
wcscspn -- Find Offset of First Wide-Character Match
wcspbrk -- Locate Wide Characters in String
wcsrchr -- Locate Wide Character in String
wcsspn -- Search Wide-Character Strings
wcswcs -- Locate Wide-Character Substring
wcscat -- Concatenate Wide-Character Strings
wcscmp -- Compare Wide-Character Strings
wcscpy -- Copy Wide-Character Strings
wcslen -- Calculate Length of Wide-Character String
wcsncmp -- Compare Wide-Character Strings
<wcstr.h>