MathGroup Archive 2003

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

Search the Archive

RE: padding in ToString


Konstantin,

Here is one method.

filename[i_] := 
  "data-" <> ToString[NumberForm[i, 3, NumberPadding -> {"0", ""}]]

filename[4]
data-0004


David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 


From: Konstantin L Kouptsov [mailto:kouptsov at wsu.edu]
To: mathgroup at smc.vnet.net


I generate a filename automatically by using

"data-"<>ToString[i]

however I would like it to be zero padded from the left (so all the 
numbers/names have the same length:

data-0000
data-0001

How can I do that?



Konstantin.



  • Prev by Date: Re: padding in ToString
  • Next by Date: Re: Eigenvalues, any suggestions?
  • Previous by thread: Re: padding in ToString
  • Next by thread: Re: padding in ToString