標準/拡張機能 | C/C++ | 依存項目 |
---|---|---|
ISO C 改訂 |
両方 |
#include <wchar.h>
size_t wcsspn(const wchar_t *string1, const wchar_t *string2);
string1 が指すストリングの初期セグメントに あって、すべて string2 が指すストリングの ワイド文字から成るワイド文字数を計算します。
このワイド文字関数の動作は、現行ロケールの LC_CTYPE カテゴリーの影響を受けます。 カテゴリーを変更すると、未定義の結果が発生する可能性があります。
wcsspn() は、ワイド文字数をセグメントに戻します。
⁄* CELEBW19
This example finds the first occurrence in the array string
of a character that is neither an a, b, nor c. Because the
string in this example is cabbage, &wcsspn. returns 5, the
index of the segment of cabbage before a character that is
not an a, b, or c.
*⁄
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t * string = L"cabbage";
wchar_t * source = L"abc";
int index;
index = wcsspn( string, L"abc" );
printf( "The first %d characters of ¥"%ls¥" are found in ¥"%ls¥"¥n",
index, string, source );
}
The first 5 characters of "cabbage" are found in "abc"