Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: Arthur J Knapp <email@hidden>
- Date: Sat, 18 Aug 2001 12:03:39 -0400
>
Date: Fri, 17 Aug 2001 11:49:41 -0400
>
Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
>
From: Paul Skinner <email@hidden>
>
>> 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
[snip]
>
on 8/17/01 10:36 AM, Arthur J Knapp wrote:
>
> Good Lord, surely it isn't as complicated as all this. Am I missing
>
> something?
Yes, I was missing a lot. :(
>
>> on addNumericSuffix(thisNum)
>
>> set {tens, units} to {thisNum mod 100 div 10, thisNum mod 10}
>
>> if units is in {1, 2, 3} and tens is not 1 then
>
>> item units of {"st", "nd", "rd"}
>
>> else
>
>> "th"
>
>> end if
>
>> return "" & thisNum & result
>
>> end addNumericSuffix
Brillant stuff, Nigel :)
(My excuse? Well, you see, on my planet, 101 would be "One Hundred
and Oneth"... )
(I wish you people would stick to problems involving the text item
delimiters... )
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://MacScripter.net