Document the arg() function QML adds to the String prototype.
authorMartin Jones <martin.jones@nokia.com>
Wed, 27 Jun 2012 02:51:43 +0000 (12:51 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 27 Jun 2012 05:26:46 +0000 (07:26 +0200)
Task-number: QTBUG-23577
Change-Id: I6279860bd3bf2d60bc394c012ea1c64bdd9be6fa
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/qml/doc/src/javascript/hostenvironment.qdoc
src/qml/doc/src/javascript/string.qdoc [new file with mode: 0644]
src/qml/doc/src/typesystem/basictypes.qdoc

index 77a57ad..01c55a0 100644 (file)
@@ -63,7 +63,7 @@ detailed in the \l{QML Global Object} documentation.
 QML makes the following modifications to native objects:
 
 \list
-\li An arg() function is added to the String prototype.
+\li An \l {String::arg}{arg()} function is added to the \l String prototype.
 \li Locale-aware coversion functions are added to the \l Date and \l Number prototypes.
 \endlist
 
diff --git a/src/qml/doc/src/javascript/string.qdoc b/src/qml/doc/src/javascript/string.qdoc
new file mode 100644 (file)
index 0000000..b9a6ac1
--- /dev/null
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+    \qmlclass String
+    \inqmlmodule QtQuick 2
+    \brief The String object represents a string value
+
+    The QML String object extends the JS String object with
+    the arg() function.
+
+    \sa {ECMA-262}{ECMAScript Language Specification}
+*/
+
+/*!
+    \qmlmethod string String::arg(value)
+
+    Returns a copy of this string with the lowest numbered place marker replaced by value,
+    i.e., %1, %2, ..., %99.  The following example prints "There are 20 items"
+
+    \code
+    var message = "There are %1 items"
+    var count = 20
+    console.log(message.arg(count))
+    \endcode
+*/
+
index c24787b..2689e31 100644 (file)
@@ -142,6 +142,9 @@ See \l {QML Basic Types} for the list of basic types that are supported by the Q
     Strings have a \c length attribute that holds the number of
     characters in the string.
 
+    QML extends the JavaScript String type with a \l {String::arg}{arg()} function
+    to support value substitution.
+
     \sa {QML Basic Types}
 */