SUBSTITUTE

This function creates a string combined of literal values and "replacement zones" for which values are substituted at run time.

Replacement zones are indicated by the use of curly braces { } enclosing numbers. Numbers must start with zero and be consecutive, although they need not necessarily appear in the string in the correct order. For example, you could have a string like the following:

"We have a new customer order {1} for our customer {0} in the amount of {2}."

The following string, however, is not valid, because there is no replacement zone for zero:

"We have a new customer order {1} for our customer {2} in the amount of {3}."

Return Value

String

Syntax

SUBSTITUTE( string, arg1 [, arg2, ... ] )

where:

  • string is the basic string containing the replacement zones.
  • arg#s indicate the sources for the replacement text to go into the replacement zones. These are typically expressions.

These must appear in the order they are numbered within the string. That is, the first argument (arg1) is used for {0}; the second argument (arg2) is used for {1}, and so forth.