[Qt-interest] Comparing two StringLists

Ian Thomson Ian.Thomson at iongeo.com
Wed Jan 7 12:24:32 CET 2009


Hi,

If you have STL compatability, use std::set_symmetric_difference which 
does what you want. It requires that the lists are sorted, which you can 
either do by ensuring they are sorted as you create/maintain them, or by 
calling QStringList::sort() beforehand which uses qSort, one of qt's 
generic algorithms.

Cheers,
Ian.

Khizer Kapadia wrote:
> Hi,
> I need to compare two stringlists. I need to find out items in list A 
> which are not in list B and vice versa. Currently I am using loops to 
> perform this task, going through each list. Is there any function 
> provided by Qt to perform this faster?
>  
> Thank you
> *Khizer*
> 
> 
> 
> ------------------------------------------------------------------------
> Windows LiveTM Hotmail®: Chat. Store. Share. Do more with mail. See how 
> it works. 
> <http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_howitworks_012009>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

This email and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed.  If you are not the original recipient or the person responsible for delivering the email to the intended recipient, be advised that you have received this email in error, and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you received this email in error, please immediately notify the sender and delete the original.






More information about the Qt-interest-old mailing list