From: dblack@... Date: 2007-03-01T20:56:40+09:00 Subject: Re: Stepping out on a Limb - some very ugly code Hi -- On Thu, 1 Mar 2007, Samantha wrote: > On 2/28/07, dblack@wobblini.net wrote: >> >> Hi -- >> >> >> > >> > ------------When I get to this point, if I typed in the answers to >> the >> > prompts with the first letter capitalized (ie Samantha for the >> first >> name), >> > when the program verifies what I typed whatever values it is >> verifying, >> as >> > blank... >> >> That's because capitalize!, like a lot of bang methods, returns nil >> if >> no change has occurred in the receiver. So David.capitalize! is >> nil. > > > Ahhh, that makes sense. I tried it both ways, capitalizing and > without > capitalizing, and noticed that it had that behavior. I don't think I > want > to redefine the bang method (scary scary scary). But, what can I do > to fix > this? Lose the !. Just issue a new string with capitalize. There's no serious performance or memory issue here (unless someone has a name the size of "War and Peace" :-) David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)