Builds compound text from a number of variables placed in a format string. The format string contains plain text and a number of numbered place holders in that text of the form %n, where n is in the range 1..20 and represents the corresponding subsequent arguments. Use %% to indicate the % character. Identifying arguments numerically is useful when multiple user interface languages must be considered, as shown in the example. The format string can also be given as a numerical string ID, in which case it will be substituted by the equivalent string loaded from Modeller's resources.
| format | string | |
| arg1 | optional string | |
| arg2 | optional string | |
| arg3 | optional string | |
| arg4 | optional string | |
| arg5 | optional string | |
| arg6 | optional string | |
| arg7 | optional string | |
| arg8 | optional string | |
| arg9 | optional string | |
| arg10 | optional string | |
| arg11 | optional string | |
| arg12 | optional string | |
| arg13 | optional string | |
| arg14 | optional string | |
| arg15 | optional string | |
| arg16 | optional string | |
| arg17 | optional string | |
| arg18 | optional string | |
| arg19 | optional string | |
| arg20 | optional string | |
| Return value | string |
Example
number = "10"
if (language == "French") then
fruit = "pommes"
colour = "rouge"
' in French, adjectives come after the noun
fmt = "J'ai %1%% des %3 %2"
else
fruit = "apples"
colour = "red"
' in English, adjectives come before the noun
fmt = "I have %1%% of the %2 %3"
end if
msgbox(localFormat(fmt, number, colour, fruit))
would display the string "I have 10% of the red apples" for English,
and "J'ai 10% des pommes rouge" in French
msgbox(localFormat(IDS_ELEMENT_NAME))
would display the string "Element", correctly translated for the current user interface language
Back to Modeller
Back to Overview