如何将ASCII控制字符插入TCL字符串中?
我需要创建一个包含ASCII控制字符的TCL脚本。 但我只对将“启动文本”值2和“文本末端”放入值3。
这是从ASCII表中的这些字符的完整列表, net/x9e5b.png“ rel =“ nofollow noreferrer”>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过编写
\ xnn
在字符串中输入十六进制代码,其中nn
是代码,例如,请参见
You can enter a hex code in a string by writing
\xnn
wherenn
is the code, e.g.See the documentation at https://www.tcl-lang.org/man/tcl8.6/TclCmd/Tcl.htm#M27
您也可以使用
格式
与%C
代码(如果您在运行时都不知道相关号码,这可能会更有用,因为它在变量中或其他):You can also use
format
with the%c
code (which might be more useful if you don't know the relevant number until run-time because it's in a variable or whatever):如果我要以控制序列(通常是针对使用着色之类的东西)包装文本,那么我将做一个工作以完成工作:
If I'm going to be wrapping text in a control sequence (often for things like applying a colouring) then I'll make a procedure to do the job: