It returns the length of the string, in terms of bytes.
DeclarationFollowing is the declaration for std::string::length.
size_t length() const;C++11
size_t length() const noexcept;Parameters
none
Return ValueIt returns the length of the string, in terms of bytes.
ExceptionsNever throw any exceptions.
ExampleIn below example for std::string::length.
#include <iostream> #include <string> int main () { std::string str ("Sairamkrishna Mammahe"); std::cout << "The size of str is " << str.length() << " bytes.\n"; return 0; }
The sample output should be like this −
The size of str is 21 bytes.
string.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4