0

everyone. I need to split a QString by any type of whitespaces as fast as possible. Now I am using QRegExp, but this method takes a lot of time. Is there a faster option to do that?

QString l = "one two  three   four    five"; 
lst = l.split(QRegExp("\\s+"), QString::SkipEmptyParts);
Yarycka
  • 165
  • 1
  • 10

1 Answers1

0

The only other way I could know is by using the simplified() method:

QString l = "one two  three   four    five";
QStringList lst = l.simplified().split(" ");

I have no idea how it compares in performance against regexp though.

Massimo Callegari
  • 2,099
  • 1
  • 26
  • 39