Re: question of formatting with PaddedForm
- To: mathgroup at smc.vnet.net
- Subject: [mg28567] Re: [mg28556] question of formatting with PaddedForm
- From: Ken Levasseur <Kenneth_Levasseur at uml.edu>
- Date: Sat, 28 Apr 2001 21:35:56 -0400 (EDT)
- References: <200104270756.DAA12785@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jim:
Here's a solution, probably not the most efficient, but it works:
In[38]:=
Map[StringJoin[Map[ToString, PadLeft[IntegerDigits[#], 3]]] &,
Range[98, 105]] // TableForm
Out[38]//TableForm=
098
099
100
101
102
103
104
105
Ken Levasseur
Math Sciences
UMass Lowell
jabauer at oanet.com wrote:
> Hello all,
>
> I am having some difficulties getting a formatted output to look like I
> 'think' it should look. What I want looks like this (three digits, padded
> with leading zeros for numbers less than 100):
>
> 098
> 099
> 100
> 101
> 102
> 103
> 104
> 105
>
> But, when I try this:
>
> For[i = 98, i <= 105,
> Print[PaddedForm[i, 2, NumberPadding -> {"0", "0"},
> SignPadding ->
> False]];
> i++]
>
> I get this:
>
> 098
> 099
> 0100
> 0101
> 0102
> 0103
> 0104
> 0105
>
> I only want three digits, not the extra leading zero for values >= 100. Can
> anyone point me in the right direction? Thanks in advance.
>
> Jim
>
> ps - I tried to post this a couple of days ago but it didn't show up.
>
> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email abuse at newsone.net
- References:
- question of formatting with PaddedForm
- From: jabauer@oanet.com
- question of formatting with PaddedForm