BString str = "Hello World"; int len = str.getLength(); // returns 11
BString str = ""; bool isEmpty = (str.getLength() == 0); // returns true
BString str = "foo"; if (str.getLength() > 2) { cout << "The string is longer than 2 characters" << endl; }This example creates a BString object containing the string "foo" and checks if its length is greater than 2. If the condition is true, the message "The string is longer than 2 characters" will be printed to the console. Package/library: Borland C++ Builder.