formatValue

fnvoid formatValue(Writer, T, Char)(auto ref Writer w, auto ref T val, scope const ref FormatSpec!Char f)

Formats a value of any type according to a format specifier and writes the result to an output range.

More details about how types are formatted, and how the format specifier influences the outcome, can be found in the definition of a

format string.

Parameters

wan output range where the formatted value is written to
valthe value to write
fa FormatSpec defining the format specifier
Writerthe type of the output range w
Tthe type of value val
Charthe character type used for f

Throws

A FormatException if formatting did not succeed.

Note

In theory this function should be @nogc. But with the current

implementation there are some cases where allocations occur. See sformat for more details.

See Also

formattedWrite which formats several values at once.