Mojo 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 slice, which must contain only a single character.
Returns:
An integer representing the code point of the given character.
ord(s: StringSlice[origin]) -> 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 (
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!