wcspbrk
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <wchar.h> で定義
|
||
wchar_t* wcspbrk( const wchar_t* dest, const wchar_t* str ); |
(C95以上) | |
str の指すワイド文字列にも含まれる最初の文字を dest の指すワイド文字列から探します。
引数
| dest | - | 解析するヌル終端ワイド文字列を指すポインタ |
| src | - | 検索する文字を含むヌル終端ワイド文字列を指すポインタ |
戻り値
str にも含まれる dest 内の最初の文字を指すポインタ、またはそのような文字が存在しない場合は NULL。
ノート
この関数の名前は「wide character string pointer break」の略です。 最初の区切り (break) 文字を指すポインタを返すためです。
例
Run this code
#include <stdio.h>
#include <wchar.h>
int main(void)
{
const wchar_t* str = L"Hello world, friend of mine!";
const wchar_t* sep = L" ,!";
unsigned int cnt = 0;
do {
str = wcspbrk(str, sep); // find separator
if (str) str += wcsspn(str, sep); // skip separator
++cnt; // increment word count
} while (str && *str);
wprintf(L"There are %u words.\n", cnt);
}
出力:
There are 5 words.
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.29.4.5.3 The wcspbrk function (p: 436)
- C99 standard (ISO/IEC 9899:1999):
- 7.24.4.5.3 The wcspbrk function (p: 382)
関連項目
(C95) |
別のワイド文字列に含まれないワイド文字のみで構成される先頭部分の最大の長さを返します (関数) |
(C95) |
ワイド文字列中のワイド文字が現れる最初の位置を探します (関数) |
| 文字列中の任意の文字が別の文字列中に現れる最初の位置を探します (関数) | |
wcspbrk の C++リファレンス
| |