you are in: codestackercodes [RSS]turning numbers into ordinals

turning numbers into ordinals Delicious

show/hide lines
   1  def ordinal(rank) 
   2    result = case rank 
   3      when 4..20: h(rank) + "th" 
   4      else 
   5      result = case (rank.modulo(10)) 
   6        when 1: h(rank) + "st" 
   7        when 2: h(rank) + "nd" 
   8        when 3: h(rank) + "rd" 
   9        else h(rank) + "th" 
  10      end 
  11    end 
  12    result 
  13  end
created by leozera — 29 September 2008 — get a short url — tags: number ruby embed

Comments

   1  vnutzK  <a href="http://hudbwdupphrs.com/">hudbwdupphrs</a>, [url=http://nrbqwcvlzsvc.com/]nrbqwcvlzsvc[/url], [link=http://whhoptxnxdxs.com/]whhoptxnxdxs[/link], http://yiuufnajtdci.com/

zcigagdpjs — 19 October / 23:16
   1  t9T09u  <a href="http://wemahbppajem.com/">wemahbppajem</a>, [url=http://rcuizvlxgzzz.com/]rcuizvlxgzzz[/url], [link=http://utiqxxgvxxqt.com/]utiqxxgvxxqt[/link], http://edrwnyjjmoxp.com/

uzspiufc — 12 November / 04:37


We dont send spam :)

If checked, it's highlights your comment