std:: wcslen
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
wcslen
(
const
wchar_t
*
str
)
;
|
||
넓은 문자열의 길이를 반환합니다. 즉, 종료 널 와이드 문자 앞에 있는 널이 아닌 와이드 문자의 개수입니다.
str 가 가리키는 와이드 문자 배열에 널 문자가 없는 경우 동작은 정의되지 않습니다.
목차 |
매개변수
| str | - | 검사할 null 종료 와이드 문자열에 대한 포인터 |
반환값
널 종료 와이드 문자열 str 의 길이.
가능한 구현
std::size_t wcslen(const wchar_t* start) { // 참고: start가 nullptr인지 확인되지 않음! const wchar_t* end = start; while (*end != L'\0') ++end; return end - start; } |
예제
이 코드 실행
#include <iostream> #include <cwchar> int main() { const wchar_t* str = L"Hello, world!"; std::wcout << "The length of L\"" << str << "\" is " << std::wcslen(str) << '\n'; }
출력:
The length of L"Hello, world!" is 13
참고 항목
|
주어진 문자열의 길이를 반환합니다
(함수) |
|
|
다음 멀티바이트 문자의 바이트 수를 반환합니다
(함수) |
|
|
C 문서
for
wcslen
|
|