Format (FPScript)

21.09.2021

Formats a value and returns the result as a string.

Syntax

Format(Format, Value)

 

The syntax of the Format function consists of the following parts:

Part

Description

Format

The formatter that determines the output format.

Permitted data structures are scalar value. Supported data types are string.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Value

The value to be formatted.

All data structures are allowed. All data types are permitted.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Remarks

The result always has the data type string.

The formatted value is returned as a string. If the Value argument is a data series or a data matrix, the calculation is made on a per element basis and the result is also a data series or data matrix. In the case of aggregate data structures, only the Y component is calculated. The data set structure of the result then corresponds to the structure of the Value argument's Y component.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Format("%.5g", 1.234567)

Results in "1.2346". Formats the floating point value as a floating point number with 5 valid places.

Format("%.5g", DataSeries)

Formats a data series as a floating point number with 5 valid places. The result is also a data series.

Format("%p", 135)

Results in "0.75 Pi". Formats the floating point value as an angle in radians.

Format("%.4p", 135)

Results in "3/4 Pi". Formats the floating point value as a fraction of Pi in radians.

See Also

Formatter

String Operator

Share article or send as email:

You might be interested in these articles