Re: Ordinal Numbers (1st, 2nd, etc.)
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