Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: Victor Yee <email@hidden>
- Date: Fri, 17 Aug 2001 06:19:59 -0400
On Fri, 17 Aug 2001 10:47:27 +0100, Nigel Garvey wrote,
>
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
Amazing! That's twice as fast as any of the others.
So, where do I sign up for that fan club?
:)
Victor