This function returns a character string that is made up of a base string plus the substitution of arguments in the string. It allows you to use a single string in place of concatenated strings. It is designed to simplify the task of translating an application from one language to another. This function is similar to the sprintf function in the C programming language.
SUBSTITUTE ( base-string , arg )A CHARACTER or LONGCHAR variable optionally containing substitution parameters of the form &n, where n is an integer between 1 and 9, inclusive.
MESSAGE SUBSTITUTE("There were &1 records in &2 tables",rec-count, table-count).
MESSAGE "There were" rec-count "records in"table-count "tables".
SUBSTITUTE("&2 comes before &1", "Friday", "Monday").
The SUBSTITUTE function is double-byte enabled. The specified base-string and arg values can contain double-byte characters.
To include an ampersand character in base-string, enter two ampersands (&&).
If you use a substitution parameter in base string but do not specify a corresponding argument, the AVM replaces the substitution parameter with an empty string.
Any substitution parameter can appear multiple times in base string. For example:
phrase = "finish on time".DISPLAY SUBSTITUTE("When I say &1, I mean &1!", phrase) FORMAT "X(70)".
When I say finish on time, I mean finish on time!
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |