PrintfToString Function

Action

Returns a formatted expression as a string.

Syntax

sString = PrintfToString (sFormat, aArgs, ...)
Variable Description
sString The formatted string. STRING.
sFormat The format to use. STRING.
aArgs Any number of arguments to format. ANYTYPE.

Notes

Like Printf, PrintfToString formats an expression, given a format string and one or more arguments. But instead of printing a formatted expression to the results file, PrintfToString returns the formatted expression as a string.

Example

STRING sText
NUMBER nMyReal = 45.7
sText = PrintfToString ("%4.2f", nMyReal)
Print (sText)
Print (Len (sText))
Print (Left (sText, 2))

// Result:
// 45.70
// 5
// 45