what is the difference between QString::sprintf and QString::arg in Qt? -
qstring documentation in http://doc.qt.io/qt-5/qstring.html#arg says
one advantage of using arg() on sprintf() order of numbered place markers can change, if application's strings translated other languages, each arg() still replace lowest numbered unreplaced place marker, no matter appears.
what meaning of this? can please explain example?
say start with:
qstring format("%1: %2 %3);
then call:
format.arg("something");
format be:
"something: %1 %2"
...meaning can build string go.
changing order of place markers possible through qt's translation mechanism, allows say:
format = tr("hi, %1, hope %2");
and add translation table , have parameters in different order different languages.
Comments
Post a Comment