• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ordinal Numbers (1st, 2nd, etc.)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ordinal Numbers (1st, 2nd, etc.)


  • Subject: Re: Ordinal Numbers (1st, 2nd, etc.)
  • From: Nigel Garvey <email@hidden>
  • Date: Fri, 17 Aug 2001 10:47:27 +0100

Jason Bourque wrote on Thu, 16 Aug 2001 22:05:20 -0400:

>Ok one last try
>
>
>on addNumericSuffix(thisNum)
>
> if thisNum is 0 then return 0
>
> set tempNum to "0" & thisNum
>
> set numSuffix to "th"
>
> if (character -2 of tempNum) is not "1" and (character -1 of tempNum) is
>in {"1", "2", "3"} then
> set numSuffix to item (character -1 of tempNum) of {"st", "nd",
>"rd"}
> end if
>
> (thisNum & numSuffix) as text
>end addNumericSuffix

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

Is there a proper English way to ordinalise negatives and fractional
numbers? Minus oneth or minus first? 3.2th or 3.2nd?

NG


  • Follow-Ups:
    • Re: Ordinal Numbers (1st, 2nd, etc.)
      • From: Paul Berkowitz <email@hidden>
    • Re: Ordinal Numbers (1st, 2nd, etc.)
      • From: Paul Skinner <email@hidden>
  • Prev by Date: Re: Trouble with double arrow script
  • Next by Date: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Previous by thread: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Next by thread: Re: Ordinal Numbers (1st, 2nd, etc.)
  • Index(es):
    • Date
    • Thread