[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
format left-padding with zero's ?
From: |
Jan Nieuwenhuizen |
Subject: |
format left-padding with zero's ? |
Date: |
Sat, 12 Oct 2002 11:28:26 +0200 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) |
What is a nice way to convert a number to a minimum-length string,
left-padded with zeros?
>From the info pages:
The `format' procedure, to be found in module `(ice-9 format)', can
do all this, and even more. If you are a C programmer, you can think
of this procedure as Guile's `fprintf'.
However:
$ guile -c '(use-modules (ice-9 format))
> (format #t "~s: ~04x\n" (version) 9)'
"1.7.0": 9
$ printf '%04x\n' 9
0009
(yesterday's CVS).
Greetings,
Jan.
--
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien | http://www.lilypond.org
- format left-padding with zero's ?,
Jan Nieuwenhuizen <=