EMPTY()

This method checks if a string is empty (contains no characters). It returns a boolean value: true if the string is empty (i.e., contains zero characters), otherwise false.

#include <iostream>
using namespace std;

int main() 
{
  string stringName = "Test strings";
  cout << stringName << endl;
  cout << "Size: " << stringName.empty() << endl;

  return 0;

}

Last updated