#include#include int main() { QStringList colors = {"red", "green", "blue", "yellow"}; colors.remove("green"); qDebug() << colors; // Output: {"red", "blue", "yellow"} return 0; }
#includeIn this example, we create a QStringList called 'fruits' and a QStringList called 'toRemove' containing the strings we want to remove. We then pass the 'toRemove' QStringList to the remove() function, which removes all occurrences of the strings in the QStringList. The resulting QStringList contains {"apple", "orange", "mango"}. Package Library: Qt Library.#include int main() { QStringList fruits = {"apple", "banana", "orange", "kiwi", "mango"}; QStringList toRemove = {"banana", "kiwi"}; fruits.remove(toRemove); qDebug() << fruits; // Output: {"apple", "orange", "mango"} return 0; }