C++ Programming Code Examples C++ > Strings Code Examples Check if String is empty or not Check if String is empty or not You can use the empty() function of string to determine whether the string is empty or not. If a string is empty, function empty() will return true otherwise false Below is the code shown how to use empty() if (s8.empty()) cout << "s8 is empty" << endl; else cout << s8 << endl; String class provides a lot of capabilities for the programmer to manipulate strings, but we are discussing now only the basic things. We will cover more about string class in next topics.