Just for diversity's sake, I have often used a function like the following:

function zeroPad pText,pLength
 repeat max(0, pLength - length(pText))
    put "0" before pText
 end repeat
 return pText
end zeroPad

put zeroPad("13", 4) => "0013"
put zeroPad("5", 4) => "0004"

etc.

Recently, Peter Alcibiades wrote:

How do you pad out a series of numbers with leading zeros? Like for instance
the series is

.1.
.2.
.3.
.11.
.42.
.98.

and you want them to be

.001.
.002.
.003.
.011.
.042.
.098.

You can use the format function.  For example:

answer format("%03s",1)

will display 001 (the 3 means pad with zeros to 3 places).  So if the
decimal points in your number series are intentional, you could make a
function like:

function padNumbers pSeries
  repeat for each line tNum in pSeries
put "." & format("%03s",char 2 to -2 of tNum) & "." & cr after newSet
  end repeat
 return newSet
end padNumbers


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design



_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to