I'm stuck with this. I am trying to tokenize a multiline QString and count the number of lines.
QStringList sentences = m_text.split(QRegularExpression("\n|$"), Qt::SkipEmptyParts);
qDebug() << sentences.size();
In spite of the Qt::SkipEmptyParts
behaviour, I keep getting 1
for a string like this, which should report 5
:
Hello\n\n\n\n\n
Any Idea of what's wrong.
By the way, if the string has something at the end the count works fine:
Hello\n\n\n\n\nBye
reports 6
sentences.