From: "David A. Black" Date: 2005-10-08T05:41:09+09:00 Subject: Re: Code for title-casing (US) snail addresses? Hi -- On Sat, 8 Oct 2005, James Edward Gray II wrote: > On Oct 7, 2005, at 3:06 PM, rpardee@gmail.com wrote: > >> Niiice! I'm so glad I asked. >> >> I think the only thing that doesn't get me is keeping suffixes on >> ordinals in lowercase (I need 21st, not 21St). But I should be able to >> get that together... > > Add this line, before the other gsub!(): > > my_address.gsub!(/(\d)([A-Z]+)/) { $1 + $2.downcase } You can safely downcase digits along with the letters: /\d[A-Z]+/ {|s| s.downcase } or something like that. David -- David A. Black dblack@wobblini.net