string member function empty : string empty « string « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

#include <string>
using std::string;

int main()
{
   string s1( "AA" );
   string s2( " AAB" );
   string s3;

   // 
   cout << "\n\nTesting s3.empty():" << endl;

   if ( s3.empty() )
   {
      cout << "s3 is empty; assigning s1 to s3;" << endl;
      s3 = s1;
      cout << "s3 is \"" << s3 << "\"";
   } 
   return 0;
}
Testing s3.empty():
s3 is empty; assigning s1 to s3;
s3 is "AA"








15.11.string empty
15.11.1.If string empty
15.11.2.string member function empty