sername.icn: Procedure to produce serialized names

link sername
June 27, 1997; Ralph E. Griswold
This file is in the public domain.

sername(p, s, n, i) produces a series of names of the form
p<nnn>s.  If n is given it determines the number of digits in
<nnn>.  If i is given it resets the sequence to start with i.  <nnn> is
an right-adjusted integer padded with zeros.

Ordinarily, the arguments only are given on the first call. Subsequent
calls without arguments give the next name.

For example, sername("image", ".gif", 3, 0) produces "image000.gif",
and subsequently, sername() produces "image001.gif", image002.gif",
and so on.

The defaults, if sername() is first called without any arguments is
as for the call sername("file", 3, 0, "").

If any argument changes on subsequent calls, all non-null arguments are
reset.

Source code | Program Library Page | Icon Home Page