> lang > subst | ![]() |
| Documentation |
|
Result = Subst$ ( Pattern , ReplaceString [ , ReplaceString ... ] ) Result = Subst ( Pattern , ReplaceString [ , ReplaceString ... ] )
Replaces substrings &1, &2, etc. in a pattern with the first, second, and subsequent ReplaceString argument respectively, and returns 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 may change with the language.
For example:
will be translated in french this way:
|
| 3.0 | In Gambas 3, if you want to substitute an argument whose index is greater or equal than ten,
you have to enclose the argument index between '{' and '}'.
For example:
DIM aArg AS String[]
PRINT Subst("The 9th argument is &9 and the 10th is &{10}", aArg[1], aArg[2], aArg[3], aArg[4], aArg[5], aArg[6], aArg[7], aArg[8], aArg[9], aArg[10])
|