Hi all
Working on Qt 4.4.2 on my intel mac machine.
Pls tell How to remove duplicate enteries from QStringList.
Printable View
Hi all
Working on Qt 4.4.2 on my intel mac machine.
Pls tell How to remove duplicate enteries from QStringList.
if you do not care about the order of the list:
Maybe there are more efficient ways to do that.
Or you could do
Untested, of course. Have, fun!Code:
for (int i=0; i<sl.count(); ++i) { forever { // remove all occurrences at greater indexes int p=sl.lastIndexOf(sl.at[i]); if (p==i) break; sl.removeAt(p); } }
QStringList has a remove duplicates
QStringList::removeDuplicates()
Wow! Only 11 years to give us a solution.
Do you know how long I have been sitting here waiting for this answer? Now I can finally finish my project!
Yes! I can sleep now.