WriteUint
Appends the decimal digits of an unsigned integer to a builder.
Module: Format
Signature
rux
func WriteUint(builder: *StringBuilder, value: uint64);Parameters
| Name | Type | Description |
|---|---|---|
builder | *StringBuilder | The builder to append to. |
value | uint64 | The value to write. |
As with WriteInt, there is one overload rather than one per width: a narrower unsigned value widens to uint64 on the way in, which loses nothing.
Remarks
Writes the digits and nothing else — there is no sign on an unsigned value. Zero is the single digit 0, and the largest uint64, 18446744073709551615, is the longest output there is at twenty digits.
Nothing is allocated beyond whatever growth the builder needs. This is the function to reach for while accumulating; ToString is the one that hands back a String of its own.
Example
rux
import Format::WriteUint;
import Text::StringBuilder;
var builder = StringBuilder::New();
builder.Append("read ");
WriteUint(&builder, 4096u64);
builder.Append(" bytes");
var line = builder.IntoString(); // "read 4096 bytes"
line.Free();See also
Format— the module overviewWriteInt— the same, with a sign for a negative valueToString— the digits in aStringof their ownText::StringBuilder— the builder being appended to