Mojo function
ord
ord(s: StringSlice[origin]) -> Int
Returns an integer that represents the codepoint of a single-character string.
Given a string containing a single character Codepoint
, return an integer
representing the codepoint of that character. For example, ord("a")
returns the integer 97
. This is the inverse of the chr()
function.
This function is in the prelude, so you don't need to import it.
Args:
- s (
StringSlice[origin]
): The input string, which must contain only a single- character.
Returns:
An integer representing the code point of the given character.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!