how to extract the date from string?
Unsolved
Mobile and Embedded
-
@bhargav
The way you've done it already, isn't it justlist.at(5)
?You should (probably/perhaps) use "regular expressions", http://doc.qt.io/qt-5/qregularexpression.html, for this.
If you really mean you want to parse that string to get a date, look at http://doc.qt.io/qt-5/qdate.html#fromString-1.
-
@bhargav
You should specify separator for split function:If sep is empty, split() returns an empty string, followed by each of the string's characters, followed by another empty string
For example:
QStringList list = str.split(" "); // the separator is space.
If the date is always at the end of the string and in those format, you can use this:
QDate d = QDate::fromString(str.right(10), "dd/MM/yyyy");