Formatting Column of Times

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


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

> 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

HTH,

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the Use-livecode mailing list