Skip to main content
Log in

Mojo function

oct

oct(value: SIMD[type, 1], /, *, prefix: StringSlice[0, MutableStaticLifetime] = "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 (SIMD[type, 1]): The integer value to format.
  • prefix (StringSlice[0, MutableStaticLifetime]): The prefix of the formatted int.

Returns:

A string containing the octal representation of the given integer.

oct[T: Indexer, //](value: T, /, *, prefix: StringSlice[0, MutableStaticLifetime] = "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 (Indexer): The indexer type to represent in octal.

Args:

  • value (T): The integer value to format.
  • prefix (StringSlice[0, MutableStaticLifetime]): The prefix of the formatted int.

Returns:

A string containing the octal representation of the given integer.

oct(value: SIMD[bool, 1], /, *, prefix: StringSlice[0, MutableStaticLifetime] = "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 (SIMD[bool, 1]): The bool value to format.
  • prefix (StringSlice[0, MutableStaticLifetime]): The prefix of the formatted int.

Returns:

A string containing the octal representation of the given bool.

Was this page helpful?