From: Peter Palmer Date: 2006-03-13T22:44:25+09:00 Subject: Re: Quickest way to do this string op. Answer : No you can't. Please ignore me ;) On Mon, 2006-03-13 at 22:36 +0900, Peter Palmer wrote: > Hi, > > I'm new to Ruby but can't you just use : > > "BOCA RATON".capitalize > > ? > > > Cheers, > > > Pete > > > > > > On Mon, 2006-03-13 at 22:34 +0900, Kroeger, Simon (ext) wrote: > > > > > -----Original Message----- > > > From: Carlos [mailto:angus@quovadis.com.ar] > > > Sent: Monday, March 13, 2006 2:31 PM > > > To: ruby-talk ML > > > Subject: Re: Quickest way to do this string op. > > > > > > eastcoastcoder@gmail.com wrote: > > > > > > > What's the quickest way to turn "BOCA RATON" into "Boca Raton"? > > > > > > "BOCA RATON".replace "Boca Raton" # :-P > > > > > > Probably > > > > > > "BOCA RATON".split(/\b/).map{|s| s.capitalize }.join > > > > > > It is quick to write, at least... > > > > > > HTH > > > > "BOCA RATON".gsub(/\w+/){|w| w.capitalize} > > > > is even shorter :) > > > > cheers > > > > Simon > > >