CString str = ""; if (str.IsEmpty()) { // Do something if the string is empty. } else { // Do something if the string is not empty. }
CStringList list; // A list of CString objects. for (POSITION pos = list.GetHeadPosition(); pos != NULL;) { CString str = list.GetNext(pos); if (str.IsEmpty()) { // Do something if the string is empty. } else { // Do something if the string is not empty. } }
CString str = "hello"; CString appendStr = " world"; if (!str.IsEmpty()) { str += appendStr; }`CString IsEmpty` is a part of the CString class in the MFC library of C++ which is a part of the Microsoft Foundation Class Library (MFC).