BigInt.toString

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

Parameters

sink Writer

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