0
How can we return the Length of Strings in C++?
How can we do string.Length from C#, in C++?
2 Respostas
+ 3
Or if your string is of type char*:
char* str="Hello";
cout<<str<<":"<<strlen(str)<<endl;
//Prints Hello:5
+ 1
call length():
Example:
std::string str = "Foo";
std::cout << str << ":" << str.length();
// Outputs "Foo:3"