I tried to split a QString (a filename) and I want to get parts between two dash signs in the filname.
The Filname is for example "0000000398_05WA-1384864213-218.bmp" .
However,
QStringList query;
QString filename;
QDirIterator it(qDirPictures, QDirIterator::NoIteratorFlags);
while (it.hasNext()) {
it.next();
filename = it.fileName();
query = filename.split("-");
qDebug()<<query;
}
gives me a correct output:
("0000000398_05WA", "1384864213", "218.bmp")
But if i want to access the second list item in the same iteration with:
qDebug()<<query.at(1);
I get an
"ASSERT failure in QList::at: "index out of range"...
However, if i try with:
qDebug()<<query.at(0);
I get the correct output:
"0000000398_05WA"
Whats wrong ?