GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::wcslen(3) C++ Standard Libary std::wcslen(3)

std::wcslen - std::wcslen


Defined in header <cwchar>
std::size_t wcslen( const wchar_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 by str.


str - pointer to the null-terminated wide string to be examined


The length of the null-terminated wide string str.


std::size_t wcslen(const wchar_t* start) {
// NB: no nullptr checking!
const wchar_t* end = start;
for( ; *end != L'\0'; ++end)
;
return end - start;
}

// Run this code


#include <iostream>
#include <cwchar>
#include <clocale>


int main()
{
const wchar_t* str = L"爆ぜろリアル!弾けろシナプス!パニッシュメントディス、ワールド!";


std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale("en_US.utf8"));
std::wcout << "The length of \"" << str << "\" is " << std::wcslen(str) << '\n';
}


The length of "爆ぜろリアル!弾けろシナプス!パニッシュメントディス、ワールド!" is 32


strlen returns the length of a given string
(function)
mblen returns the number of bytes in the next multibyte character
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.