Official Content

Creates a character expression with parameter markers. The string expression has zero o more parameter markers like %1.  If a '%' sign needs to be included in character-expression, it must be preceded by the '\' (backslash) sign. For example: "This is not a parameter marker: \%1".

Syntax

Format(Str [, <character-expression1>,..., <character-expressionN>])

Where:

Str
  It is a character Data Type that has zero or more parameter markers (from 1 to 9) like %1, %2, etc. It may be an expression with a translation available; therefore, the translation to the language being used when formatting will be selected.

character-expression1,...,character-expression
  Each character-expression, separated by commasreturns a character value as a result. It can be just a character fixed value, a character attribute, a character variable, or a successive combination of functions/methods that finally returns a character value.

Type Returned:
Character

Scope

Objects: ProcedureTransactionWeb PanelPanelWork With for Smart DevicesData Provider
Generators: .NET, .NET Framework, Java, Apple, Android, Angular

Samples

In the example, parameter markers are %1 and %2. They state where, in the resulting string, the values of "Alex" and "13" must be embedded.

Format("%1 is %2 years old.", "Alex", "26")

The result must be "Alex 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", CustomerName, CountryName);

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant