Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Clarification for asymetry of contains(), indexOf() and filter() for QStringList needed
StefanBruens last edited by
qsl.contains("foo") and qls.indexOf("foo") only return true resp >=0 if the list contains the full string (opposed to substring) "foo", whereas qsl.filter("foo") returns a list with all strings matching ".foo.".
Is this on purpose?
Anyway, the documentation should mention this difference.
dbzhang800 last edited by
Hi, IMO, the documentation is very clear. They are used for different cases.
If you want to find whether the list contains the string "foo" or not, should use contians().
If you want to find the index of the string "foo" in the list, you should use indexOf().
If you want to get all the strings which contains "foo" in the list, you should use filter().