What docs? In all man pages in google man printf there is "zero padding" flag '0' after %, so %02d should be used for "03".
The '.' is for fractional etc. precision. --- Henry Rich <[EMAIL PROTECTED]> wrote: > You get that with %2.2d rather than %02d . > > When I coded printf I went to the docs on the Web & found > that the %2.2d form seemed to be the one in use. It was %02d > when I was coding C, but it must have changed sometime along > the way. Or I got the wrong docs to look at. > > Henry Rich > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of efittery > > Sent: Sunday, November 25, 2007 5:06 PM > > To: [email protected] > > Subject: Re: [Jprogramming] How to convert a number to a string? > > > > > > >From the little I looked at printf.ijs written by Henry > > Rich, it looks like > > he tried to duplicate the functionality the C language > > implimentations. > > > > Also, he added new capabilities. > > > > One thing I see that seems not to work is: > > > > In C the following is true. > > > > '0' : Causes printf to use '0' (instead of spaces) to left > > fill a fixed > > length field. For example (assume i = 3) printf("%2d", i) > > results in " 3", > > while printf("%02d", i) results in "03" > > > > So, I would expect that: > > > > '%02d' printf 3 would produce "03" but it actually produces " 3" > > > > Has anybody got this to work? Maybe I will go through > > printf.ijs and modify > > it so it provides the same basic functionality that printf in > > C provides. > > > > > > > > > > neitzel wrote: > > > > > > Terrence Brannon wrote: > > >>Is there no printf-like functionality available? > > > > > > There is: require 'printf' and you get Henry Rich's excellent > > > utilities. The script follows scriptdoc conventions and there's > > > also a lab for it. > > > > > > Martin > > > > > > > > > > > > > -- > > View this message in context: > > http://www.nabble.com/How-to-convert-a-number-to-a-string--tf4 > > 093212s24193.html#a13940498 > > Sent from the J Programming mailing list archive at Nabble.com. > > > > ---------------------------------------------------------------------- > > For information about J forums see > > http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ____________________________________________________________________________________ Get easy, one-click access to your favorites. Make Yahoo! your homepage. http://www.yahoo.com/r/hs ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
