#include#include using namespace std; int main() { StringBuffer str; bool is_empty; // calling empty() method to check if StringBuffer is empty or not is_empty = str.empty(); if(is_empty) { cout << "StringBuffer is empty." << endl; } else { cout << "StringBuffer is not empty." << endl; } return 0; }
StringBuffer is empty.
#include#include using namespace std; int main() { StringBuffer str = "Hello World"; bool is_empty; // calling empty() method to check if StringBuffer is empty or not is_empty = str.empty(); if(is_empty) { cout << "StringBuffer is empty." << endl; } else { cout << "StringBuffer is not empty." << endl; } return 0; }
StringBuffer is not empty.Package library: The StringBuffer class is not a part of the standard C++ library. It is a part of the Apache Commons Lang library for Java. However, there are some implementations of the StringBuffer class for C++, such as the Boost library's boost::basic_stringbuf class.