Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: Michelle Steiner <email@hidden>
- Date: Thu, 16 Aug 2001 23:34:55 -0700
On 8/16/01 3:21 PM, Greg Back <email@hidden> wrote:
>
Does anyone know of a way to change integers (1, 2, 3) to ordinal numbers
>
(1st, 2nd, 3rd)?? I know you can set of equivalent lists and match them up,
>
but is there an easier way??
set the stringnumber to text returned of (display dialog "enter an
integer" default answer "")
try
set the enteredNumber to the stringnumber as integer
if the enteredNumber is greater than 10 and the enteredNumber is less
than 14 then
set the ordinal to the stringnumber & "th"
else if text -1 thru -1 of the stringnumber is "1" then
set the ordinal to stringnumber & "st"
else if text -1 thru -1 of the stringnumber is "2" then
set the ordinal to stringnumber & "nd"
else if text -1 thru -1 of the stringnumber is "3" then
set the ordinal to stringnumber & "rd"
else
set the ordinal to (the enteredNumber as text) & "th"
end if
on error
display dialog "I said enter an integer!"
end try
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------