RosettaCodeData/Task/Empty-string/C++/empty-string.cpp
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

11 lines
229 B
C++

#include <string>
// ...
std::string str; // a string object for an empty string
if (str.empty()) { ... } // to test if string is empty
// we could also use the following
if (str.length() == 0) { ... }
if (str == "") { ... }