MathGroup Archive 2004

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

Search the Archive

Re: padding numbers in front of uniquely generatd names

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48301] Re: padding numbers in front of uniquely generatd names
  • From: "Michel, Hans J.I." <HMiche at LSUHSC.EDU>
  • Date: Sat, 22 May 2004 03:04:33 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Sean:

You can try 

SymbolName[Unique["plot0"]] <> ".jpg"

Please note that there is a lot of overhead using Unique. I would add the
attribute of Unique["plot0", {Temporary}]

So 
Try
SymbolName[Unique["plot0", {Temporary}]] <> ".jpg"

When done with all files you should Remove all the Symbol that start with
"plot0*".

Hans Michel

Sean wrote:
hello group. 

below will do exactly what it';s supposed to do which is generate
unique file names.


StringJoin[Unique["plot"] // ToString, ".jpg"]


I wanted to pad 0's in front of my file names for the purpose of
sorting them in a folder by their names. without the 0's in front they
don't sort right.

i found this in the archive that does sort of what i want to... 

With[{i = 1}, "data-" <> ToString[PaddedForm[i, 3, NumberPadding
->{"0", "0"}]] ]

or 

Table["data-" <> ToString[ PaddedForm[i, 3, NumberPadding -> "0"]],
{i, 0, 20}]


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?

any thoughts will be most appreciated.

thanks in advance

sean



  • Prev by Date: Eigensystem: different solution in V5.0 and V4.1 ??
  • Next by Date: Re: SetPrecision - What does in find?
  • Previous by thread: Re: padding numbers in front of uniquely generatd names
  • Next by thread: Re: padding numbers in front of uniquely generatd names