Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: "Marc K. Myers" <email@hidden>
- Date: Fri, 17 Aug 2001 01:39:04 -0400
- Organization: [very little]
>
From: "Stockly, Ed" <email@hidden>
>
To: "'email@hidden'"
>
<email@hidden>
>
Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
>
Date: Thu, 16 Aug 2001 18:17:13 -0700
>
>
--But what if the user passes the number 0?
on getOrd(theNbr)
set nbrText to (theNbr as text)
if character -2 of ("0" & nbrText) is "1" then
set theSfx to "th"
else
if theNbr < 1 then
set theNbr to (theNbr * -1)
end if
set listIndx to (theNbr mod 10) + 1
set theSfx to (item listIndx of [optn-L]
{"th", "st", "nd", "rd", "th", "th", "th", "th", [optn-L]
"th", "th"}) as text
end if
return (nbrText & theSfx)
end getOrd
repeat with i from -113 to 113
log getOrd(i)
end repeat
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[8/17/01 1:36:15 AM]