 
 
 
 
 
 
Re: padding numbers in front of uniquely generatd names
- To: mathgroup at smc.vnet.net
- Subject: [mg48292] Re: padding numbers in front of uniquely generatd names
- From: Marcus Stollsteimer <marcus314 at yahoo.com>
- Date: Sat, 22 May 2004 03:04:23 -0400 (EDT)
- References: <c8kd3j$mri$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
sean kim wrote:
(snipped)
> above work fine for making the names upfront then assigning them to
> pictures, but what if i wanted to generate them as the algorythm runs.
> now i thought this was gonna do it...
> 
> 
> StringJoin[ToString[ PaddedForm[ Unique["plot"], NumberPadding ->
> {"0", "0"}]], ".jpg"]
> 
> but no, above is exactly the same as what I had before.
> 
> Without using Table, or With, how do i change it so that above will
> generate unique names with 0's padded?
Hello Sean,
PaddedForm does not work with symbol names.
you could do something like this:
filecount=0;
getfn[] :=
  Module[{digits=3},
         "data-"<>StringJoin[ToString/@IntegerDigits[filecount++,10,digits]]
                <>".ext"
  ]
gives:
In:= getfn[]
Out= data-000.ext
In:= getfn[]
Out= data-001.ext
Regards,
Marcus
-- 
It is awfully hard work doing nothing. -- Oscar Wilde

