MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

PaddedForm


Can anyone explain this?


PaddedForm[expr, n] prints with all numbers in expr padded to leave room
for a total of n digits.


In[98]:=  (12:9:35 on 7/18/98)
 NumberForm[1,2,NumberPadding->"0"]

Out[98]//NumberForm=  (12:9:35 on 7/18/98) "001"

In[99]:=  (12:9:39 on 7/18/98)
 NumberForm[10,2,NumberPadding->"0"]

Out[99]//NumberForm=  (12:9:40 on 7/18/98) "010"

In[100]:=  (12:9:45 on 7/18/98)
 NumberForm[100,2,NumberPadding->"0"]

Out[100]//NumberForm=  (12:9:45 on 7/18/98) "0100"

NumberForm gives the same behaviour.

I would have thought that in all three cases, two digits would appear,
instead of three, or four.

My real need is simply to print integers with leading zeros for a fixed
number of digits.

Regards,

Andrew B. Watson
MS 262-2
NASA Ames Research Center
Moffett Field, CA 94035-1000
(650) 604-5419	(650) 604-0255 fax
abwatson at mail.arc.nasa.gov	http://vision.arc.nasa.gov/


  • Prev by Date: The "Users" directory under NT
  • Next by Date: What's the Play picture?
  • Previous by thread: Re: The "Users" directory under NT
  • Next by thread: What's the Play picture?