wcsspn - C wchar.h

C examples for wchar.h:wcsspn

Type

function

From


<cwchar>
<wchar.h>

Description

Get span of character set in wide string

Prototype

size_t wcsspn (const 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 length of the initial portion of wcs1 containing only wide characters in wcs2.

If not found, the function returns zero.

Demo Code


#include <wchar.h>

int main ()//from   ww  w  .  jav a  2  s  . c o  m
{
  int i;

  wchar_t wcsText[] = L"test test test 129th";

  wchar_t wcsSet[] = L"1234567890";

  i = wcsspn (wcsText,wcsSet);

  wprintf (L"The initial number has %d digits.\n",i);

  return 0;
}

Related Tutorials