RE: padding in ToString
- To: mathgroup at smc.vnet.net
- Subject: [mg43718] RE: [mg43701] padding in ToString
- From: "David Park" <djmp at earthlink.net>
- Date: Thu, 2 Oct 2003 02:51:12 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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.