Function FormatString(formatstring, arguments, ...)

FormatString

With the FormatString function you can compose a string that is built up from combinations of numbers, strings and set elements. The FormatString function accepts a varying number of arguments, defined by the conversion specifiers in the format string.

FormatString(
     formatstring,    ! (input) a literal double quoted string
     arguments,       ! (input) a list of numbers, strings, and set elements
     ...
     )

Arguments

formatstring

A format string that specifies how the returned string is composed. The string should contain the proper conversion specifier for each following argument.

arguments,…

One or more arguments of type number, string or element. The order of these arguments must coincide with the order of the conversion specifiers in formatstring.

Return Value

The function returns the formatted string.

Example

The code:

p_million := 1e6 ;
sp_millions := formatString("%i %6.3n %.0g", p_million, p_million, p_million );
display sp_millions  ; ! sp_millions := "1000000 1.000e+06 1e+06" ;

Is a first illustration of various ways of formatting a number.

See also

For a detailed description of the conversion specifiers in AIMMS see Formatting Strings of the Language Reference.