CStdString str("Hello, World!"); if(!str.Empty()) { // Do something if the string is not empty }
CStdString str("Hello, World!"); if(!str.Empty()) { str.Empty(); // Clear the content of the string }In both examples, the "Empty" function is used to check whether the string is empty or not. The first example uses the negation operator to check if the string is not empty, while the second example clears the content of the string using the "Empty" function. Package library: ATL/MFC library.