From: mmm Date: 2002-02-25T11:42:50+09:00 Subject: Re: [newbie] make first letter lowercase Tobias Reif wrote: > Dave Thomas wrote: >> matz@ruby-lang.org (Yukihiro Matsumoto) writes: >> >>>Hmm, how about >>> >>> s.upcase!(0,1) >>> >> It isn't very orthogonal. > better suggestion(s)? > Tobi I do not think 'better', but 'different', is the following idea (based on PDF page 93, 'Pattern-Based Substitution' of _Programming_Ruby_ by David Thomas and Andrew Hunt http://ww.pragmaticprogrammers.com/ruby/index.html). I do like it, though, since I enjoy regular expressions (/\b\w/ finds first letter of a 'word'). s = "ALONGCAPITALIZEDWORD" s.sub!(/\b\w/) { $&.downcase } OR, use s.gsub!(/\b\w/) { $&.downcase } to downcase first letter of each word in a sentence. Michael McDaniel > -- > * peace&love. > * http://www.pinkjuice.com/ -- --- seen on bumper sticker: "In a world without fences, who needs GATES? www.linuxjournal.com"