//求两个QStringList的交集,结果保存再第一个参数中
void CommonFunc::getQStringListIntersect( QStringList& commonColumns, QStringList& currentColumns )
{
if( commonColumns.count() == 0 || currentColumns.count() == 0 )
{
commonColumns.clear();
return;
}
commonColumns.sort();
currentColumns.sort();
int x = 0, y = 0;
for( int i = x; i < commonColumns.count(); i++ )
{
int j;
for( j = y; j < currentColumns.count(); j++ )
{
if(QString::compare( commonColumns[i], currentColumns[j] ) == 0)
{
x = i + 1;
y = j + 1;
break;
}
else
{
continue;
}
}
if( j == currentColumns.count() )
{
commonColumns.removeAt(i);
--i;
}
}
}