Applying substitutions may be accomplished by using the formatString() built-in function. The formatString() function takes up to seven arguments:

         <var> = formatString(<msg>[,<sub_1>][,<sub_2>][,<sub_3>][,<sub_4>][,<sub_5>][,<sub_6>])

The <msg> argument is the string variable which was extracted from a message table. Up to six substitution arguments may be specified.

The example below shows the use of the getExternalString() and formatString() built-in functions.

# message table entry:
#
message_table MY_TABLE
message_code  OPER_FAIL_MSG, 
              "Operation &1 failed.  Reason: &2"
---------------------------------------
// ASL fragment.   An attempt to perform some operation failed. 
// the variable 'operation' holds the name of the operation that
// failed, the variable 'reason' indicates the reason for the failure. 
// 
// extract the string using the default locale (SM_LOCALE)
//
 format = getExternalString("MY_TABLE","OPER_FAIL_MSG");
// 
// format the substitutions
// 
 output = formatString(format,operation,reason)
// 
// print the resulting string
// 
 print(output);