[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple number formatting problem
- Subject: Re: Simple number formatting problem
- From: davidf(at)dfanning.com (David Fanning)
- Date: Wed, 2 Aug 2000 09:21:42 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <39883794.171F017@mathstat.dal.ca>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:20600
Simon de Vet (firstname.lastname@example.org) writes:
> Trivial problem, no doubt, but I've never been able to get my brane
> around formatting options.
> I have a list of files, with the extension .01, .02, .03 ... .12. The
> preceding portion is indentical in all cases.
> I'd like to be able to load these in a loop, but I first need to convert
> the counter value into this format.
> My current, and very ugly, technique is to have an array filled with
> ['01', '02', ... '12'], and then reference the appropriate entry. It
> works, but I don't like it.
I'd try something like this:
IDL> base = 'myfile'
IDL> ext = '.dat'
IDL> for j=1,12 do print, base + String(j, Format="(I2.2)") + ext
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: email@example.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155