From: Dominic Sisneros Date: 2005-10-08T19:10:34+09:00 Subject: Re: Code for title-casing (US) snail addresses? rpardee@gmail.com wrote: >Hey All, > >I've got to suck some address info out of a db, where it is stored in >all caps, like so: > > 14 WEST 21ST ST > 742 NW EVERGREEN TERRACE > PO BOX 13 > >And I want to pretty up the casing: > > 14 West 21st St > 742 NW Evergreen Terrace > PO Box 13 > >So it's mostly just title-casing, and then dealing w/certain special >components like 'NE', 'SW', 'PO' and so forth. > >I've actually got some vb.net code that I could convert, but I thought >I'd ask here whether someone's already got something they've sweated >over before I did. > > > I think perl has the most robust module for this and other geocoding type of methods. I was thinking of porting it but I am not too comfortable with Regular Expressions. Anyway the links is below:. http://search.cpan.org/author/SDERLE/Geo-StreetAddress-US-0.99/US.pm >Also--more concretely: for simple title-casing, is this the >easiest/best approach? > >pretty_address = my_address_var.split.each do |c| c.capitalize >end.join(" ") > >Or is there something more graceful/efficient? > >Thanks! > >-Roy > > > > > >