Skip to main content

function

ord

ord(s: String) -> Int

Returns an integer that represents the given one-character string.

Given a string representing one character, return an integer representing the code point of that character. For example, ord("a") returns the integer 97. This is the inverse of the chr() function.

Args:

  • s (String): The input string, which must contain only a single character.

Returns:

An integer representing the code point of the given character.