empty
Z cppreference.com
Składnia:
#include <string>
bool empty() const;
Metoda **empty()** zwraca TRUE, jeśli string nie zawiera znaków, FALSE w przeciwnym wypadku.
Na przykład:
string s1;
string s2("");
string s3("To jest string");
cout.setf(ios::boolalpha);
cout << s1.empty() << endl;
cout << s2.empty() << endl;
cout << s3.empty() << endl;
Kod wyświetli:
true
true
false
Powiązane tematy: size