I have a QStringList and I need to clean some meaningless elements : the empty and the null strings.
I could not find a QStringList shortcut function for that.
What is the simplest way to clean the empty/null strings ?
myQStringList.removeAll(QString("")); // Returns the number of entries removed
Empty string QString("") and null string QString() both return true when compared to an empty string.
Then the test of QList::removeAll(const T &value) will remove both empty and null strings from the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With