QString myString = "Hello World!"; myString.clear(); // Now myString is empty
QStringList myList; myList << "apple" << "banana" << "cherry"; QString joinedString = myList.join("-"); joinedString.clear(); // Now joinedString is emptyIn both examples, the clear() function is called on a QString object, which empties its contents. Package library: Qt.