need help to classify some QStringList
I have a list which contains references and another contains prices of each reference. There are some duplicates. It looks like this:
Code:
{code to fill each list}
I want to get the quantity of each reference and get the price of the sum of each duplicate so to get the result into two QStringList:
Any idea what's the best way to do this with Qt?
Thanx in advance
Pat
Re: need help to classify some QStringList
Could you explain a bit more? An example would be helpful.
Re: need help to classify some QStringList
Ok here are the two lists I have to begin with:
Code:
QStringList priceList;
// {'pricex','pricey','pricez','pricet','priceu','pricex','pricet'}
Those are the three list I want to get ( I added the quantity list) :
Code:
QStringList refListWithOutDuplicates;
//{'x','y','z','t','u'} QStringList priceList;
// {'pricex','pricey','pricez','pricet','priceu'} QStringList qtyOfEachRef;
// {'qty_of_x','qty_of_y','qty_of_z','qty_of_t','qty_of_u'}
update: by quantity I mean number of iteration of each ref.
Thanx in advance
Pat
Re: need help to classify some QStringList
http://doc.trolltech.com/4.0/qlist.html#count maybe?
Code:
qtyOfEachRef.
append(QString("%1_of_%2").
arg(refList.
count(QString("x"))).
arg("x"));
and repeat...