Re: Re: Ordinal Numbers (1st, 2nd, etc.)
Re: Re: Ordinal Numbers (1st, 2nd, etc.)
- Subject: Re: Re: Ordinal Numbers (1st, 2nd, etc.)
- From: "Greg Back" <email@hidden>
- Date: Fri, 17 Aug 2001 18:57:39 -0400
thanks for all who helped with my problem. All of the responses had their
positive aspects, but i finally decided to use
>
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
because, as Victor pointed out,
>
Amazing! That's twice as fast as any of the others.
This will become part of a *HUGE* script, and I would like to save space
whenever I can.
Also, I will probably not be using negative numbers or decimals, so that is
not really a problem.
Thanks again to everyone!!!!!
Greg