#include#include using namespace std; int main() { StringBuffer sb("Hello, World!"); // Get the length of the StringBuffer int length = sb.length(); cout << "Length of StringBuffer is: " << length << endl; return 0; }
#includeThis example creates an empty StringBuffer object and then uses the length method to get the length of the string buffer. It then prints out the length of the empty StringBuffer. Package/library: C++ Standard Library#include using namespace std; int main() { StringBuffer sb; // Get the length of the empty StringBuffer int length = sb.length(); cout << "Length of empty StringBuffer is: " << length << endl; return 0; }