| 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 | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
Defined in header <cwchar> | ||
std::size_t wcslen(constwchar_t* str); | ||
Returns the length of a wide string, that is the number of non-null wide characters that precede the terminating null wide character.
The behavior is undefined if there is no null character in the wide character array pointed to bystr.
Contents |
| str | - | pointer to the null-terminated wide string to be examined |
The length of the null-terminated wide stringstr.
std::size_t wcslen(constwchar_t* start){// NB: start is not checked for nullptr!constwchar_t* end= start;while(*end!= L'\0')++end;return end- start;} |
#include <iostream>#include <cwchar>int main(){constwchar_t* str= L"Hello, world!";std::wcout<<"The length of L\""<< str<<"\" is "<< std::wcslen(str)<<'\n';}
Output:
The length of L"Hello, world!" is 13
| returns the length of a given string (function)[edit] | |
| returns the number of bytes in the next multibyte character (function)[edit] | |
C documentation forwcslen | |