Subst

Result = Subst ( Pattern , ReplaceString [, ReplaceString ])

Replaces arguments &1, &2, etc. in a pattern with the first, second, and subsequent ReplaceStrings respectively, and return the result.

If Pattern is null, then a null string is returned.

For C developers, this is not unlike a simplified sprintf.

This function is very useful when you must concatenate strings that must be translated. Do not use the & operator, as the order of concatenation might change with the language.


Examples

PRINT Subst("Gambas is &1", "BASIC")

Gambas is BASIC


PRINT Subst(("Today, we are &1 &2"), Format$(Now, "mmm"), Format$(Now, "d"))
will be translated in french this way:
PRINT Subst(("Aujourd'hui, nous sommes le &2 &1"), Format$(Now, "mmm"), Format$(Now, "d"))