views:

158

answers:

1

I have a string that I would like to print . Is it possible to center it when printing ?

+9  A: 

Use the ~< formatting directive. This will return "hello there" centered within 70 columns.

(format nil "~70:@<~A~>" "hello there")
Glomek
Thank you! Can you point me in the direction of other examples of format?
Vhaerun
Here is the Hyperspec section on `format`:http://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm
Nathan Sanders
Thanks Nathan! I appreciate it !
Vhaerun
Seibel also has some examples: http://www.gigamonkeys.com/book/a-few-format-recipes.html
Frank Shearar