What is the equivalence for QString::arg() in QML

s4eed picture s4eed · Oct 6, 2012 · Viewed 10.5k times · Source

I'm wondering How I can have a string in QML that will be occupied with some arguments? Some thing like this in Qt:

QString str("%1 %2");
str = str.arg("Number").arg(12);//str = "Number 12"

Answer

Dickson picture Dickson · Dec 1, 2012

In QML environment, the arg() function already added to the string prototype, so basically you can use the string.arg() in QML just like C++.

There is less documentation about this, but I'm sure it works in Qt 4.7 + QtQuick 1.1

Take at look at the Qt 5 doc : http://qt-project.org/doc/qt-5.0/qtqml/qml-string.html