• 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: Ordinal Numbers (1st, 2nd, etc.)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ordinal Numbers (1st, 2nd, etc.)


  • Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
  • From: Bill Briggs <email@hidden>
  • Date: Thu, 16 Aug 2001 21:34:30 -0300

Close, but it breaks down at 111, 112, 113, 211, 212, 213, 311, 312, 313, etc. You'll have to build in a check for the "teens" in every "century".

- web

Give this a try

on addNumericSuffix(thisNum)
set the listIndex to (thisNum mod 10) + 1
if thisNum is less than 11 then
set the numSuffix to item listIndex of ,
{"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"}
else if thisNum is greater than 10 and thisNum is less than 20 then
set the numSuffix to item listIndex of ,
{"th", "th", "th", "th", "th", "th", "th", "th", "th", "th"}
else
set the numSuffix to item listIndex of ,
{"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th"}
end if
return ((thisNum as text) & the numSuffix)
end addNumericSuffix


set x to {}

repeat with nth from 1 to 113
my addNumericSuffix(nth)
set end of x to result
end repeat
X

Jason Bourque
_______________________________________________
applescript-users mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Follow-Ups:
    • Re: Ordinal Numbers (1st, 2nd, etc.)
      • From: Shane Stanley <email@hidden>
    • Re: Ordinal Numbers (1st, 2nd, etc.)
      • From: Jason Bourque <email@hidden>
References: 
 >Re: Ordinal Numbers (1st, 2nd, etc.) (From: Jason Bourque <email@hidden>)

  • Prev by Date: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Next by Date: RE: Ordinal Numbers (1st, 2nd, etc.)
  • Previous by thread: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Next by thread: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Index(es):
    • Date
    • Thread