I tried
> (format t "~2,'0D" 7)
07
NIL
> (format t "~2@D" 7)
+7
NIL
Couldn't figure out how to combine the above.
(format t "~2,'0@D" 7) didn't work
Help please
-Antony
> Couldn't figure out how to combine the above.
> (format t "~2,'0@D" 7) didn't work
I don't think it's possible with only one directive, since the padding
happens in front of the sign:
CL-USER> (format t "~3,'0@D" 7)
0+7
Ick.
I'd probably end up with something like
CL-USER> (format t "~:[+~;-~]~2,'0D" (sign 7) (abs 7))
+07
But it's not pretty. I'd love to see a variant with only one format
argument, if that's possible. (and without using ~/ - that's cheating
:) )
...Peder...
--
Sl�v uten dop.
You may need to write your own custom formatting function. See:
http://www.lispworks.com/documentation/HyperSpec/Body/22_ced.htm.
Mirko
A reminder that the package for the name in "~/name/" defaults
to COMMON-LISP-USER, *not* the current value of *PACKAGE*.
Yes, I know it says that quite clearly, but it's easy to overlook
and can cause confusion later when you move from playing with stuff
in the default REPL to packaging up [pardon the pun] your code in
a separate module.
-Rob
-----
Rob Warnock <rp...@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607