Par*_*ife 4 lisp string-formatting
我想做这个
(format nil "One occurence of ~X , another one: ~X , and yet another one: ~X" #\some-char)
Run Code Online (Sandbox Code Playgroud)
有没有X格式指令可以做到这一点?
找到它:它 ~:*
告诉lisp重用最后一个参数.就像在一个地方倒退论点一样.
有关整个说明的段落,请参阅:http://www.gigamonkeys.com/book/a-few-format-recipes.html(它位于页面底部附近)
所以它变成了
(format nil "One occurence of ~C , another one: ~:*~C , and yet another one: ~:*~C" #\a)
=> "One occurence of a , another one: a , and yet another one: a"
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
204 次 |
最近记录: |