Anonymous user
Empty string: Difference between revisions
added c++
(per previous discussion, removing claim about syntax for empty strings; update examples; copyedit) |
(added c++) |
||
Line 23:
if (strcmp(str, "") == 0) { ... }
</lang>
=={{header|C++}}==
<lang cpp>#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 == "") { ... }</lang>
=={{header|D}}==
|