Scope
Objects: Procedures,
Transactions,
Web PanelsLanguages: .NET, Ruby, Java, RPG, Visual Basic, Visual FoxPro, Cobol
Purpose
To allow creating character expression with parameter markers.
Syntax:
Format(character-expression1 [ ,
character-expression2 [ ,… ] ]
)
Type Returned:Character
Where:character-expression1 Must be a Character Expression. This is the expression that has zero or more parameters markers (from 1 to 9) like %1, %2, etc.
character-expressionn Must be a Character Expression. These are character expressions that will replace the parameter markers.
Description
This function is used to create a character expression with parameters markers. The string expression has zero o more parameters markers like %1. If a '%' sign must be included in character-expression, it must be preceded by the '\' (backslash) sign. For example:
"This is not a parameter marker: \%1".
Examples
In the example, parameter markers are %1 and %2. They state where, in the resulting string, the values of "Alex" and "13" must be embeded.
Format("%1's age is %2 years old.", "Alex", "26")
The result must be "Alex's age is 26 years old".
In this example, the markers are substituted with attributes and the result is moved to a variable which can be used later:
&Variable=format("Customer %1 was born in %2", CusName, CountryName);