Unsigned Integer Types¶
Unsigned integer types represent non-negative whole numbers.
Module: Std
Summary¶
ToString(value: uint8) -> String
ToString(value: uint16) -> String
ToString(value: uint32) -> String
ToString(value: uint64) -> String
uint8.ToString() -> String
uint16.ToString() -> String
uint32.ToString() -> String
uint64.ToString() -> String
Description¶
Rux provides multiple unsigned integer types:
| Type | Size | Range |
|---|---|---|
uint8 |
8 bits | 0 to 255 |
uint16 |
16 bits | 0 to 65,535 |
uint32 |
32 bits | 0 to 4,294,967,295 |
uint64 |
64 bits | 0 to 18,446,744,073,709,551,615 |
All unsigned integer types implement the Display interface.
String Conversion¶
ToString¶
uint8¶
Converts a uint8 value into its decimal string representation.
Internally, the value is converted to uint64 and formatted using the uint64 implementation.
uint16¶
Converts a uint16 value into its decimal string representation.
Internally, the value is converted to uint64 and formatted using the uint64 implementation.
uint32¶
Converts a uint32 value into its decimal string representation.
Internally, the value is converted to uint64 and formatted using the uint64 implementation.
uint64¶
Converts a uint64 value into its decimal string representation.
Examples¶
Result:
Result:
Display Implementation¶
All unsigned integer types implement the Display interface.
This allows unsigned integer values to be used with formatting and output functions.
Example¶
Output:
Formatting¶
Unsigned integer values can be used with Format().
Example¶
Result:
Notes¶
- All conversions produce decimal output.
- Unsigned integers cannot represent negative values.
- Zero is represented as
"0". uint8,uint16, anduint32use theuint64formatter internally.- A new string is allocated for each conversion.