question about find and replace
J. Landman Gay
jacque at hyperactivesw.com
Tue Sep 30 14:08:57 EDT 2008
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.
My solution, among the many:
function paddedList pList
put "0000" into tPadding
repeat for each line l in pList
put char 2 to -2 of l into tNum
put "." & char 1 to (3 - len(tNum)) of tPadding & \
tNum & "." & cr after tList
end repeat
return tList
end paddedList
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list