wcsrchr -- Locate Wide Character in String

Format

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

Language Level: XPG4
wcsrchr locates the last occurrence of character in the string pointed to by string. The terminating wchar_t null character is considered to be part of the string.

Return Value
wcsrchr returns a pointer to the character, or a NULL pointer if character does not occur in the string.

Example
This example compares the use of wcschr and wcsrchr. It searches the string for the first and last occurrence of p in the wide character string.

#include <stdio.h>
#include <wcstr.h>
#define SIZE 40
int main(void)
{
  wchar_t buf[SIZE] = L"computer program";
  wchar_t * ptr;
  int    ch = 'p';
  /* This illustrates wcschr */
  ptr = wcschr( buf, ch );
  printf( "The first occurrence of %c in '%ls' is '%ls'\n", ch, buf, ptr );
  /* This illustrates wscrchr */
  ptr = wcsrchr( buf, ch );
  printf( "The last occurrence of %c in '%ls' is '%ls'\n",  ch, buf, ptr );
  return 0;
  /****************************************************************************
      The output should be:
      The first occurrence of p in 'computer program' is 'puter program'
      The last occurrence of p in 'computer program' is '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
wcschr -- Search for Wide Character
wcscmp -- Compare Wide-Character Strings
wcscspn -- Find Offset of First Wide-Character Match
wcsncmp -- Compare Wide-Character Strings
wcsspn -- Search Wide-Character Strings
wcswcs -- Locate Wide-Character Substring
wcspbrk -- Locate Wide Characters in String
<wcstr.h>