Better help for format function

Added description of what syntax/parsing engine is used for the formatting. Motivated by https://github.com/qgis/QGIS/issues/42806, but in general a good idea so users can look up more in detail what is possible. Also uniformized spelling (placeholder vs placeholder).
This commit is contained in:
Martin Pergler 2021-05-04 19:04:36 -04:00 committed by GitHub
parent f5449a1fe9
commit 2fed93cdfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,10 @@
"groups": ["String"],
"description": "Format a string using supplied arguments.",
"variableLenArguments": true,
"arguments": [ {"arg":"string", "description":"A string with place holders for the arguments. Use %1, %2, etc for placeholders. Placeholders can be repeated."},
"arguments": [ {"arg":"string", "description":"A string with placeholders %1, %2, etc., for the arguments. Placeholders can be repeated. The lowest numbered placeholder is replaced by arg1, the next by arg2, etc."},
{"arg":"arg1", "syntaxOnly": true},
{"arg":"arg2", "syntaxOnly": true},
{"arg":"arg", "descOnly": true, "description":"any type. Any number of arguments."}],
"examples": [ { "expression":"format('This %1 a %2','is', 'test')", "returns":"'This is a test'"}
]
"examples": [ { "expression":"format('This %1 a %2','is', 'test')", "returns":"'This is a test'"},
{ "expression":"format('This is %2','a bit unexpected but 2 is lowest number in string','normal')", "returns":"'This is a bit unexpected but 2 is lowest number in string'"} ]
}