QString split() function with QRegExp strange behaviour

180 views Asked by At

I have some text like this:

"1.801908\t20.439980\t\r\n25.822865\t20.439305\t\r\n26.113739\t4.069647\t\r\n1.800252\t4.301690\t\r\n"

I want to split this text by lines and then by tabs. I am using QString split() function and QRegExp to do that in this way:

QStringList rows = text.split(QRegExp("[\r\n]"), QString::SkipEmptyParts);
QStringList cols = rows.at(0).split(QRegExp("[ \t]"), QString::SkipEmptyParts);

But what I got in cols is just one item:

  "1.801908\920.439980\9"

As I understand, the first split replaced all the \t characters with \9. But I don't understand why and how to fix that. Any explanation?

0

There are 0 answers