10 6 57 Substitute

LANSA Technical

10.6.57 Substitute

Substitute allows you to replace text at a series of predetermined points in a string, identified by &1, &2…&9.

Input Parameters

String1 - Substitution value

String2 - Substitution value

String3 - Substitution value

String4 - Substitution value

String5 - Substitution value

String6 - Substitution value

String7 - Substitution value

String8 - Substitution value

String9 - Substitution value

Example

In this example, *MtxtCust01 is a multilingual variable containing the following:

"&1 &2 has a limit of $&3"

#Givename, #Surname and #Limit have values of Veronica, Brown and 2000 respectively.

The result at run-time would be:

Veronica Brown has a limit of $2000.

#Com_owner.caption := *MtxtCust01.Substitute(#Givename #Surname #Limit.AsString)

 

Note: If two ampersands appear together in a string, they are reduced to a single ampersand and not considered for substitution.

For example:

#str1 := "&1&&2"
#str2 := #str1.Substitute( "a" "b" )
 
#str2 will equal "a&2"
 

Ý 10.6 Alphanumeric/String Intrinsic Functions