Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

PaddedForm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13371] PaddedForm
  • From: Andrew Watson <abwatson at mail.arc.nasa.gov>
  • Date: Mon, 20 Jul 1998 02:50:23 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

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?