Mojo function
hex
hex(value: SIMD[type, 1], /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0x")) -> String
Returns the hex string representation of the given integer.
The hexadecimal representation is a base-16 encoding of the integer value.
The returned string will be prefixed with "0x" to indicate that the subsequent digits are hex.
Args:
- value (
SIMD[type, 1]
): The integer value to format. - prefix (
StringSlice[StaticConstantOrigin]
): The prefix of the formatted int.
Returns:
A string containing the hex representation of the given integer.
hex[T: Indexer, //](value: T, /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0x")) -> String
Returns the hex string representation of the given integer.
The hexadecimal representation is a base-16 encoding of the integer value.
The returned string will be prefixed with "0x" to indicate that the subsequent digits are hex.
Parameters:
- T (
Indexer
): The indexer type to represent in hexadecimal.
Args:
- value (
T
): The integer value to format. - prefix (
StringSlice[StaticConstantOrigin]
): The prefix of the formatted int.
Returns:
A string containing the hex representation of the given integer.
hex(value: SIMD[bool, 1], /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0x")) -> String
Returns the hex string representation of the given scalar bool.
The hexadecimal representation is a base-16 encoding of the bool.
The returned string will be prefixed with "0x" to indicate that the subsequent digits are hex.
Args:
- value (
SIMD[bool, 1]
): The bool value to format. - prefix (
StringSlice[StaticConstantOrigin]
): The prefix of the formatted int.
Returns:
A string containing the hex representation of the given bool.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!