Integer Functions

Integers have multiple built-in functions you can use.

  fun toString(): String

Returns the string representation of the integer.

    let answer = 42

    answer.toString()  // is "42"

-

  fun toBigEndianBytes(): [UInt8]

Returns the byte array representation ([UInt8]) in big-endian order of the integer.

    let largeNumber = 1234567890

    largeNumber.toBigEndianBytes()  // is `[73, 150, 2, 210]`

Last updated