wcspbrk - C wchar.h

C examples for wchar.h:wcspbrk

Type

function

From


<cwchar>
<wchar.h>

Description

Locate characters in wide string

Prototype

const wchar_t* wcspbrk (const wchar_t* wcs1, const wchar_t* wcs2);
      wchar_t* wcspbrk (      wchar_t* wcs1, const wchar_t* wcs2);

Parameters

Parameter Description
wcs1 C wide string to be scanned.
wcs2 C wide string containing the characters to match.

Return Value

the first occurrence in wcs1 of any of the wide characters in wcs2.

A null pointer if not found.

Demo Code

#include <wchar.h>

int main ()/*from   w w  w.ja v a  2s .  com*/
{
  wchar_t wcs[] = L"This is a sample wide string";
  wchar_t key[] = L"aeiou";
  wchar_t * pwc;
  wprintf (L"Vowels in '%ls': ",wcs);
  pwc = wcspbrk (wcs, key);
  while (pwc != NULL)
  {
    wprintf (L"%c " , *pwc);
    pwc = wcspbrk (pwc+1,key);
  }
  wprintf (L"\n");
  return 0;
}

Related Tutorials