• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: numbers and prefix zero
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: numbers and prefix zero


  • Subject: Re: numbers and prefix zero
  • From: kai <email@hidden>
  • Date: Sat, 12 Feb 2005 19:20:55 +0000


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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: numbers and prefix zero
      • From: Paul Richardson <email@hidden>
  • Prev by Date: Re: Handlers in applications
  • Next by Date: Re: numbers and prefix zero
  • Previous by thread: Re: suspend execution of a script
  • Next by thread: Re: numbers and prefix zero
  • Index(es):
    • Date
    • Thread