0

How to find the length of string in c++

No of characters... Not the size

14th Dec 2016, 5:24 PM
Mayan Pahwa
Mayan Pahwa - avatar
2 Respostas
0
// string::length #include <iostream> #include <string> int main () { std::string str ("Test string"); std::cout << "The size of str is " << str.length() << " bytes.\n"; return 0; }
14th Dec 2016, 5:26 PM
Emil Voica
Emil Voica - avatar
0
int strLength; string strName = "bsbdbdhjfgdjdjdhggff"; strLength = strlen(strName); cout << strLength << endl;
14th Dec 2016, 6:29 PM
Franky BrainBox
Franky BrainBox - avatar