View source code
Display the source code in std/bigint.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal clone.
Function std.bigint.BigInt.toString
Convert the BigInt to string, passing it to the given sink.
void toString(Writer)(
scope ref Writer sink,
string formatString
) const;
void toString(Writer)(
scope ref Writer sink,
scope const ref FormatSpec!char f
) const;
void toString(
scope void delegate(scope const(char)[]) sink,
string formatString
) const;
void toString(
scope void delegate(scope const(char)[]) sink,
scope ref const(FormatSpec!(char)) f
) const;
Parameters
| Name | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| sink | An OutputRange 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
std:
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-2025 by the D Language Foundation | Page generated by ddox.