View source code
Display the source code in std/bigint.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.bigint.BigInt.toString
Convert the BigInt
to string
, passing it to the given sink.
void toString
(
scope void delegate(const(char)[]) sink,
string formatString
) const;
void toString
(
scope void delegate(const(char)[]) sink,
ref const(FormatSpec!(char)) f
) const;
Parameters
Name | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sink | A delegate for accepting possibly piecewise segments of the formatted string. | ||||||||||||
formatString | A format string specifying the output format.
|
Example
toString
is rarely directly invoked; the usual way of using it is via
format
:
import std .format : format;
auto x = BigInt("1_000_000");
x *= 12345;
writeln(format("%d", x)); // "12345000000"
writeln(format("%x", x)); // "2_dfd1c040"
writeln(format("%X", x)); // "2_DFD1C040"
writeln(format("%o", x)); // "133764340100"
Authors
Don Clugston
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.