std:: wcscspn
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>
|
||
|
std::
size_t
wcscspn
(
const
wchar_t
*
dest,
const
wchar_t
*
src
)
;
|
||
dest 가 가리키는 와이드 문자열의 최초 세그먼트 중 src 가 가리키는 와이드 문자열에 포함되지 않은 문자로만 구성된 가장 긴 세그먼트의 길이를 반환합니다.
목차 |
매개변수
| dest | - | 분석할 null로 종료되는 와이드 문자열에 대한 포인터 |
| src | - | 검색할 문자가 포함된 null로 종료되는 와이드 문자열에 대한 포인터 |
반환값
src 가 가리키는 문자열에 없는 문자들만 포함하는 최대 초기 세그먼트의 길이.
예제
아래 출력은 clang(libc++)을 사용하여 얻은 결과입니다.
이 코드 실행
#include <cwchar> #include <iostream> #include <locale> int main() { wchar_t dest[] = L"白猫 黑狗 甲虫"; // └───┐ const wchar_t* src = L"甲虫,黑狗"; const std::size_t len = std::wcscspn(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 3. The segment is "白猫 ".
참고 항목
|
다른 와이드 문자열에서 발견되는 와이드 문자들로만 구성된
최대 초기 세그먼트의 길이를 반환합니다 (function) |
|
|
하나의 와이드 문자열에서 다른 와이드 문자열에 있는
어떤 와이드 문자의 첫 번째 위치를 찾습니다 (function) |
|
|
C documentation
for
wcscspn
|
|