Qt 6.11 is out! See what's new in the release
blog
Getting the fourth line QString
-
hi ,
I want to get the fourth line of a text inside QStringQString str = "1 \n 2 \n 3 \n 4 \n 5 \n 6 \n";@MrErfan
QStringList list = str.split("\n");
return list[3];Have a look at the overloads of http://doc.qt.io/qt-5/qstring.html#split to decide just what you want to split on, e.g. perhaps a
QRegExp.EDIT: P.S.
split()does not scale optimally if you have, say, a million+ lines instr--- let us know if that is a possible factor ;-)