Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Number to string headed by zeros

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110303] Re: Number to string headed by zeros
  • From: David Annetts <david.annetts at iinet.net.au>
  • Date: Sun, 13 Jun 2010 04:07:40 -0400 (EDT)

Hi Rui,

On 12/06/2010 17:32, Rui wrote:
> I need to create strings out of integers, padding them with zeros,
> cause otherwise they end up sorted in the wrong order. "10.gif" before "1.gif".
> For now I'm gonna do it by adding 1000, converting to string, and
> taking the heading 1, but I'm sure there are better options. THanks
>
> Rui
>
>    
The archives have many variations on a theme of

     StringDrop[ToString@PaddedForm[#, 3, NumberPadding -> {"0", ""}],
    1] & /@ Range[0, 99]

YMMV,

D.


  • Prev by Date: Re: Automatic update of variables
  • Next by Date: Re: Number to string headed by zeros
  • Previous by thread: Re: Number to string headed by zeros
  • Next by thread: Re: Number to string headed by zeros