Ruby Newbie-help regarding strings

Hello All,

I am very new to ruby.I have a small doubt.

suppose i have a string called 'add',I want this to get saved when given in any of the following conditions

like

"ADD" 'aDD' 'Add'

it should be converted back in to small case and displayed back

how can i achieve this

Thanks Jagan

use .downcase

http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_string.html#String.downcase

string.downcase returns the downcased version of the string - it does not affect the source object. If you want that reference to become downcase you need

str = "ADD"

str = str.downcase

str.downcase will do what it's supposed to, but str will still be whatever it was originally. If you're new to OO programming this one can really confuse you.