"subst" (string::subst)

Substitutes the placeholders ($1 to $9) in a string with the specified arguments and returns the substituted string.

Synopsis

string.subst( string substitution, ...);

Parameters

Parameter Description
substitution String. The placeholder in the specified string is replaced by, in the order from $1 to $9 .

Description

This string member function will substitute the placeholders $1 to $9 with the strings given as arguments and return the substituted string.

Substituting placeholders in a translation with the tr() function:

DebugN(tr("The file $1 could not be read due to error $2").subst(fileName, eror));

With this, the constant string literal in the tr() function call can be extracted by projectTranslationUpdate() and during runtime the translated text will be shown with the $-Parameters replaced with given arguments.

Assignment