From: Jean-pierre Riviere Date: 2006-11-14T19:19:56+09:00 Subject: capitalize bug? Hi! I'm a new member here, though I use and enjoy ruby for about three years. There's a beginning to everyuthing, including thing not doing the way you think they should, even in ruby! So here's my problem: @nom = wnom.gsub(/_+(.)/, '\1'.upcase) What this code should do is taking the string wnom, and removing every _ and at the same time capitalizing the letter immediatly after. for instance do_it_now would become doItNow. One way to translate ruby usage into camel case. but this code does in fact producte doitnow instead of doItNow. Now, I am not blocked, because I have achieved my goal with this code: nom = wnom.gsub(/_+(.)/) { |deb| deb[1, 1].upcase } but this is less clear, and surely less efficient (although this is not a real problem in my case). My question is WHY does my first code NOT do what I think it should? Thank you for your help. -- Jean-Pierre -- Posted via http://www.ruby-forum.com/.