BigInt.toString

Convert the BigInt to string, passing it to the given sink.

  1. void toString(Writer sink, string formatString)
  2. void toString(Writer sink, FormatSpec!char f)
  3. void toString(void delegate(scope const(char)[]) sink, string formatString)
    struct BigInt
    const
    void
    toString
    (
    scope void delegate
    (
    scope const(char)[]
    )
    sink
    ,)
  4. void toString(void delegate(scope const(char)[]) sink, FormatSpec!char f)

Parameters

sink void delegate
(
scope const(char)[]
)

An OutputRange for accepting possibly piecewise segments of the formatted string.

formatString string

A format string specifying the output format.

Available output formats:,
"d"Decimal
"o"Octal
"x"Hexadecimal, lower case
"X"Hexadecimal, upper case
"s"Default formatting (same as "d")
nullDefault formatting (same as "d")

Examples

toString is rarely directly invoked; the usual way of using it is via std.format.format:

import std.format : format;

auto x = BigInt("1_000_000");
x *= 12345;

assert(format("%d", x) == "12345000000");
assert(format("%x", x) == "2_dfd1c040");
assert(format("%X", x) == "2_DFD1C040");
assert(format("%o", x) == "133764340100");

Meta