Zero pad (was: getting the date)
Zero pad (was: getting the date)
- Subject: Zero pad (was: getting the date)
- From: Christopher Stone <email@hidden>
- Date: Tue, 30 Dec 2003 17:37:23 -0600
At 12:48 -0800 12/30/2003, Walter Ian Kaye wrought:
At 12:36p -0500 12/30/2003, Graff didst inscribe upon an electronic papyrus:
on ZeroPad(theNumber)
set theString to ""
...
You could shorten that to:
...
if theNumber is less than 10 then set theString to "0"
______________________________________________________________________
Let's shorten that up a bit more:
These two have nearly identical speed runs on my machine.
on ZeroPad(theNumber)
if theNumber is less than 10 then set theString to "0" & theNumber
end ZeroPad
on ZeroPad(theNumber)
text 2 thru -1 of ((d + 100) as string)
end ZeroPad
Chris
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.