Clarification for asymetry of contains(), indexOf() and filter() for QStringList needed
-
Hi,
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.
Regards, Stefan
-
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().