Skip to main content

function

atol

atol(str: String, base: Int = 10) -> Int

Parses and returns the given string as an integer in the given base.

For example, atol("19") returns 19. If base is 0 the the string is parsed as an Integer literal, see: https://docs.python.org/3/reference/lexical_analysis.html#integers.

Args:

  • str (String): A string to be parsed as an integer in the given base.
  • base (Int): Base used for conversion, value must be between 2 and 36, or 0.

Returns:

An integer value that represents the string, or otherwise raises.

Raises:

If the given string cannot be parsed as an integer value. For example in atol("hi").