Does Io have built in methods that mirror the ord()
and chr()
functions in other languages (namely being able to take an integer and return the ASCII character associated with it, or take a string character and return the ASCII number for that character)?
Is there a print
/write
function that allows for formatting of the output? I'm wanting to create ANSI colored output to the command line, and need the means to print an escape character (ASCII character 27) to do that.
For chr()
see asCharacter
in the Number
object.
For ord()
either asBinarySignedInteger
or asBinaryUnsignedInteger
from the Seqence
object seems to fit the bill.
# ord
"@" asBinarySignedInteger println # => 64
# chr
64 asCharacter println # => "@"