Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 17 Aug 2001 09:09:15 -0700
On 8/17/01 2:47 AM, "Nigel Garvey" <email@hidden>
wrote:
>
That's very nice! :-) Just to speed it up a bit:
>
>
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
Best of show! One picky detail - to avoid making AS do a coercion, it should
really be:
if {units} is in {1, 2, 3} and tens is not 1 then
In fact, since I've never heard of an "integer-to-list" coercion, there may
be several coercions going on (integer-to-string-to-list,
integers-to-strings), so maybe it will go _even faster_ with the correct
syntax. (I'm too lazy to check.)
>
>
Is there a proper English way to ordinalise negatives and fractional
>
numbers? Minus oneth or minus first? 3.2th or 3.2nd?
Come on, Nigel! I don't think ordinals exist except for integers - there's
no such thing as a fractional ordinal. (And if there were, it would have to
be "third-and-two-tenth" or something nutty like that). Negative ordinals?
How about "first below zero"?
--
Paul Berkowitz