wcspbrk() — Locate Wide Characters in String

Format

#include <wchar.h>
wchar_t *wcspbrk(const wchar_t *string1, const wchar_t *string2);

Language Level: XPG4

Threadsafe: Yes.

Wide Character Function: See Wide Characters for more information.

Description

The wcspbrk() function locates the first occurrence in the string pointed to by string1 of any wide character from the string pointed to by string2.

Return Value

The wcspbrk() function returns a pointer to the character. If string1 and string2 have no wide characters in common, the wcspbrk()function returns NULL.

Example that uses wcspbrk()

This example uses wcspbrk() to find the first occurrence of either "a" or "b" in the array string.

#include <stdio.h>
#include <wchar.h>
 
int main(void)
{
  wchar_t * result;
  wchar_t * string = L"The Blue Danube";
  wchar_t *chars = L"ab";
 
  result = wcspbrk( string, chars);
   printf("The first occurrence of any of the characters \"%ls\" in "
          "\"%ls\" is \"%ls\"\n", chars, string, result);
 
}
 
/****************  Output should be similar to:  ******************
 
The first occurrence of any of the characters "ab" in "The Blue Danube"
is "anube"
******************************************************************/

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]