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: [mg110308] Re: Number to string headed by zeros
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 13 Jun 2010 04:08:36 -0400 (EDT)
  • References: <huvk6s$rse$1@smc.vnet.net>

Hi Rui,

Before version 6 you used something like:

ToString[PaddedForm[17651, 8, NumberPadding -> {"0", "0"},
  NumberSigns -> {"-", ""}, SignPadding -> True]]

but with the advent of IntegerString in v6 you could do it much
simpler like:

IntegerString[17651, 10, 8]

Cheers -- Sjoerd

On Jun 12, 11:32 am, Rui <rui.r... at gmail.com> 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



  • 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