Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove strings contained in one QStringList, from another QStringList

I was wondering if anyone knew of a Qt library method that can take two QStringList and remove all of the strings contained in one list from the second list.

like image 864
Wes Avatar asked Aug 20 '26 14:08

Wes


1 Answers

There is no library function in QList nor QStringList.

But you can write your own method:

void remove(QStringList& list, const QStringList& toDelete){
  QStringListIterator i(toDelete);
  while(i.hasNext()){
    list.removeAll(i.next());
  }
}
like image 95
Mhh Lecker Avatar answered Aug 23 '26 04:08

Mhh Lecker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!