IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

chr

def chr(c: Int) -> String

Returns a String based on the given Unicode code point. This is the inverse of the ord() function.

This function is in the prelude, so you don't need to import it.

Example:

print(chr(97), chr(8364)) # "a €"

Args:

  • ​c (Int): An integer that represents a code point.

Returns:

String: A string containing a single character based on the given code point.