UString str("Hello World"); if (str.empty()) { std::cout << "String is empty" << std::endl; } else { std::cout << "String is not empty" << std::endl; }
UString str("Hello World"); str.clear(); if (str.empty()) { std::cout << "String is now empty" << std::endl; } else { std::cout << "String is not empty" << std::endl; }This example initializes a UString object with the value "Hello World". The clear function is then called on the object to remove all its contents. The empty function is then called on the object to confirm that it is now empty. The UString function empty is a part of the ICU library.