Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.9.0, 5.9.1
-
None
Description
The documentation for QStringList::replaceInStrings does not specify the effects when an empty string is provided for the before argument, since the outcome is not what IMHO most of the developers would expect.
Here is the example:
QStringList mylist; mylist << "ONE" << "TWO"<<"THREE"; QString after = "dummy"; QString before; // same with QString before=""; qDebug()<< mylist; mylist.replaceInStrings(before, after); qDebug()<< mylist;
which results in an output:
("ONE", "TWO", "THREE") ("dummyOdummyNdummyEdummy", "dummyTdummyWdummyOdummy", "dummyTdummyHdummyRdummyEdummyEdummy")
Based on the discussion on forum.qt.io, this kind of behavior would come in handy when one would want to put something between characters (blatantly copied one of the replies made by jsulm).