Formatting Column of Times

Ken Ray kray at
Tue Sep 6 18:54:59 EDT 2005

On 9/6/05 5:41 PM, "Stephen Barncard" <stephenREVOLUTION at>

> Hi everyone,
> is there a way to use the format function to make timings line up
> right-justified? -- i.e. pad with leading zeros and/or spaces? Or do
> I have to roll my own? I've been faking this for years but if there's
> a function...

You'd need a field with a monospaced font, but then you could do this:

  put format("%5s",tTimeVal)

Which will pad spaces before any value that is less than 5 chars. So if you
had your column of times, you could do this:

function formatTimes pTimes
  put "" into tNewTimes
  repeat for each line tTime in pTimes
    put format("%5s",tTime) & cr after tNewTimes
  end repeat
  delete char -1 of tNewTimes
  return tNewTimes
end formatTimes


Ken Ray
Sons of Thunder Software
Web site:
Email: kray at

More information about the Use-livecode mailing list