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: [mg110315] Re: Number to string headed by zeros
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 13 Jun 2010 04:09:52 -0400 (EDT)

data = {1, 9, 10, 90};

IntegerString[#, 10, 3] <>
   ".gif" & /@ data

{001.gif,009.gif,010.gif,090.gif}


Bob Hanlon

---- Rui <rui.rojo 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: Number to string headed by zeros
  • Next by Date: Re: Automatic update of variables
  • Previous by thread: Re: Number to string headed by zeros
  • Next by thread: Re: Number to string headed by zeros