BloombergLP::bslalg::NumericFormatterUtil::toChars

Format floating-point value using format and precision.

Synopsis

Declared in <bslalg_numericformatterutil.h>

static
char*
toChars(
    char* first,
    char* last,
    double value,
    Format format,
    int precision) noexcept;

Description

Write the specified floating point value into the character buffer starting at the specified first and ending at the specified last, last not included, using the specified format and precision. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last )] is not large enough to contain the result. The written result is to begin at first with leftover room following the return value. The behavior is undefined unless first <= last. Note that these functions do not null-terminate the result.

Return Value

pointer past the last character written, or null on failure

Parameters

NameDescription
firstbeginning of the output character range
lastend of the output character range
valuefloating-point value to format
formatfloating-point formatting style
precisionnumber of digits after the radix point