Format (Tag-based PE function)
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Convert a number to string according to a format expression.
Syntax
Format(x, format [,numType ])
Arguments
x
A numeric value (real or integer).
format
Format-control string. This is the same as that used by the C language function Sprintf.
numType
Optional. Character indicating number type, either R(eal) or I(nteger). The default is R.
Returns
A formatted string.
Example
Format('sinusoid', "%3.3f", "R") = "66.890"
Format(45, "%3.3d") = "045"
Format(45, "%3.3d", "I") = "045"
Format(45, "%3.3d", "R") = "000" (Don't do this!)