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

qml, qstring, qt

Solution

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

Problem

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" ```

Original source