Io 字符串(序列)操作/格式化?
Io 是否有内置方法来镜像其他语言中的 ord()
和 chr()
函数(即能够获取整数并返回与其关联的 ASCII 字符) ,或者获取一个字符串字符并返回该字符的 ASCII 数字)?
是否有允许格式化输出的 print
/write
函数?我想要创建 ANSI 彩色输出到命令行,并且需要打印转义字符(ASCII 字符 27)的方法来执行此操作。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于
chr()
请参阅asCharacter
/数字“rel=”nofollow noreferrer">Number
对象。对于
ord()
要么asBinarySignedInteger
或asBinaryUnsignedInteger
< /a> 来自Seqence
对象似乎符合要求。For
chr()
seeasCharacter
in theNumber
object.For
ord()
eitherasBinarySignedInteger
orasBinaryUnsignedInteger
from theSeqence
object seems to fit the bill.