std:: wcsspn
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Null-terminated wide strings
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
|
ヘッダーで定義
<cwchar>
|
||
|
size_t wcsspn
(
const
wchar_t
*
dest,
const
wchar_t
*
src
)
;
|
||
dest が指すワイド文字列の先頭部分で、 src が指すワイド文字列に含まれる文字のみで構成される最大のセグメントの長さを返します。
目次 |
パラメータ
| dest | - | 解析対象のヌル終端ワイド文字列へのポインタ |
| src | - | 検索対象の文字を含むヌル終端ワイド文字列へのポインタ |
戻り値
src が指すワイド文字列からのみの文字を含む最大初期セグメントの長さ。
例
このコードを実行
#include <cwchar> #include <iostream> #include <locale> int main() { wchar_t dest[] = L"白猫 黑狗 甲虫"; const wchar_t src[] = L" 狗猫 白黑 "; const std::size_t len = std::wcsspn(dest, src); dest[len] = L'\0'; // terminates the segment to print it out std::wcout.imbue(std::locale("en_US.utf8")); std::wcout << L"The length of maximum initial segment is " << len << L".\n"; std::wcout << L"The segment is \"" << dest << L"\".\n"; }
出力例:
The length of maximum initial segment is 6. The segment is "白猫 黑狗 ".
関連項目
|
別のワイド文字列に含まれないワイド文字のみで構成される
最大の先頭セグメントの長さを返す (function) |
|
|
あるワイド文字列中のワイド文字のうち、別のワイド文字列で最初に見つかった位置を検索する
(function) |
|
|
C documentation
for
wcsspn
|
|