Common-Lisp以功能格式打印制表符 [英] Common-Lisp printing the tab character in function format
问题描述
我希望使用format
功能打印制表符.我可以用~C
来实现,然后将#\tab
用作format的参数,但这似乎有点冗长,因为换行符只需将~%
放在字符串中即可.
I wish to print the tab character with the format
function. I can achieve this with ~C
and then placing #\tab
as an argument to format, but this seems a bit verbose as for a newline one can simply place a ~%
in the string.
- 使用
format
功能打印标签的最常用方法是什么?
- What is the most commonly used practise for printing tabs with the
format
function?
感谢所有帮助!
推荐答案
FORMAT
中没有制表符的表示法.
There is no notation for the tab character in FORMAT
.
有几种选择,但没有一个真的很不错.
There are several choices, but none is really really good.
-
正如您提到的,
-
使用
#\tab
(或设置为字符的变量)作为参数对我来说是可以的
use
#\tab
(or a variable set to the character) as the argument, as you mention, is okay for me
在字符串中嵌入了文字制表符.这可能会因某些编辑器设置而中断,其中编辑器将制表符替换为空格.它也不是直接可见的.
embed a literal tab character in the string. This may break with some editor settings, where the editor replaces tabs with spaces. It's also not directly visible.
使用格式字符串中的函数,该函数将写入制表符
use a function in a format string, which writes a tab character
使用阅读器宏引入扩展的字符串语法.可能还不错.也许甚至存在一个.在comp.lang.lisp上有一个示例.
use a reader macro to introduce extended string syntax. Probably not bad. Maybe there exists even one. There was a post on comp.lang.lisp with an example.
这篇关于Common-Lisp以功能格式打印制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!