For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
oct
oct(value: Scalar, /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String
Returns the octal string representation of the given integer.
The octal representation is a base-8 encoding of the integer value.
The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.
Args:
- value (
Scalar): The integer value to format. - prefix (
StringSlice[StaticConstantOrigin]): The prefix of the formatted int.
Returns:
String: A string containing the octal representation of the given integer.
oct[T: Intable, //](value: T, /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String
Returns the octal string representation of the given integer.
The octal representation is a base-8 encoding of the integer value.
The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.
Parameters:
- T (
Intable): The intable type to represent in octal.
Args:
- value (
T): The integer value to format. - prefix (
StringSlice[StaticConstantOrigin]): The prefix of the formatted int.
Returns:
String: A string containing the octal representation of the given integer.
oct(value: Scalar[DType.bool], /, *, prefix: StringSlice[StaticConstantOrigin] = StringSlice("0o")) -> String
Returns the octal string representation of the given scalar bool.
The octal representation is a base-8 encoding of the bool.
The returned string will be prefixed with "0o" to indicate that the subsequent digits are octal.
Args:
- value (
Scalar[DType.bool]): The bool value to format. - prefix (
StringSlice[StaticConstantOrigin]): The prefix of the formatted int.
Returns:
String: A string containing the octal representation of the given bool.