Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QString::arg Documentation Confusion
ResistorInTheDark last edited by ResistorInTheDark
This post has to do with my confusion (and potentially the confusion of others) over a particular QString::arg documentation.
I'm not sure where to put this post so I decided to throw it in wiki discussion.
The last example of the section states
QString str; str = "%1%2%3"; str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
I'm rather confused. Shouldn't it either be
str = "%1%3%2";(line 2)
// returns "Hello2050"(line 3)?
I'm sort of inferring that it's supposed to be
str = "%1%3%2";from the point its trying to make. I'm hoping that someone can clarify this for me and perhaps fix it.
Thanks for any clarifications.
It looks like a mistake in the documentation. From the context, we can guess that it should be:
String str; str = "%1%3%2"; str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020"
ResistorInTheDark last edited by
This post is deleted!
JonB last edited by
I believe the format string was correct/intended, and the comment for the output is what was incorrect.... :)
thanks for your findings and conclusions. I've prepared a patch to fix the documentation: https://codereview.qt-project.org/238951
Please note that in future you can do discussions about (assumed) bugs here, but the final report should be at bugreports.qt.io, so they are not lost.
Thanks and regards.
so, the patch got merged and will be in 5.11.2 or 5.12.
So we can close this topic.
@aha_1980 Thanks for haviing handling this. Good job