Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: numbers and prefix zero




On Sat, 12 Feb 2005 17:36:54 +0100, Christian Vinaa <email@hidden> wrote:


so the short version is:

set a to 10
set b to (text -2 thru -1 of ("00" & (a + 1)))

For a slightly shorter 2-digit version, you might try losing a "0" - and maybe even a couple of parentheses:


set b to text -2 thru -1 of ("0" & a + 1)

Alternatively, it can sometimes be a bit faster to calculate, rather than to concatenate:

set b to text -2 thru -1 of (100 + a + 1 as string)

Of course, to deal with negative 2-digit values, you'll need to do a bit more than that. But, hey - if there's a snow blizzard outside anyway... ;-)

---
kai

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.