On 05/12 17:00:20, William Ramsay wrote:
Is there an easy way to format a number with a possible leading zero
using format or sprintf?
In other words I want 9 to show us as 09 and 10 to show is as is.
I don't think you can do it with the default format/sprintf, but with
the format egg you can:
#;1> (use format)
; loading /usr/local/lib/chicken/3/format.so ...
#;2> (format #t "~2,'0D~%" 9)
09
#t
#;3> (format #t "~2,'0D~%" 10)
10
#t
Bill
There's an example here (search for "zero"):
http://www.lisp.org/HyperSpec/Body/sec_22-3.html
Pete.
--
C makes it easy for you to shoot yourself in the foot. C++ makes that
harder, but when you do, it blows away your whole leg.
-- Bjarne Stroustrup
_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users