NAME

format - creates a String or WideString representation of values based on a format specification

SYNOPSIS

str = format(fmtspec, val, ...)

DESCRIPTION

The list of values (which may be empty) is formatted according to fmtspec and the resulting String or WideString value is returned.

RETURN VALUE

The formatted string. If characters which are not representable as ASCII values are contained in the string, a WideString is returned. Otherwise, a String is returned

ERRORS

ArgCheck for an incorrect number of arguments
TypeCheck for a non-string fmtspec
FormatCheck for a syntax error in fmtspec (note that static format strings will be checked at compile-time, not run-time)

EXAMPLE

    #include "libstd"
    str = format("ST,F12.2", math::D_PI*1_000_000.)
    str
3,141,592.65

    typeof(str)
String

    str = format("'1 million \x3C0 =',ST,F12.2", math::D_PI*1_000_000.)
    str
1 million π = 3,141,592.65

    typeof(str)
WideString

SEE ALSO

OADL Format Specifiers
print