You are not logged in.

1

Monday, July 27th 2015, 4:02am

how to split the QString quickly

QFilefile(str);
if(!file.open(QIODevice::ReadOnly))
return;
QTextStreamin(&file);
QTextCodec*codec=QTextCodec::codecForName("utf-8");
in.setCodec(codec);while(!in.atEnd()){
QString line=codec->fromUnicode(in.readLine());
QStringListstrList=line.split("",QString::SkipEmptyParts);

for(inti=0;i<strList.size();i++)
{

if(!enVector.contains(strList.at(i)))

enDicVector.append(strList.at(i));

enVector.append(strList.at(i));

}


as i said befoe,i tried to process 300,000 lines text file.
this way takes me too much time,please give me some ideas.thx!

2

Monday, July 27th 2015, 6:28am

i got the problem,now a new question is:
is there any class like "set" in c++ in QT to save no-repeat words ?thx for your help!

Similar threads

Used tags

QString, Qt5.4, split